@nestia/sdk 2.4.3 → 2.4.4

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 (70) hide show
  1. package/lib/INestiaConfig.d.ts +13 -0
  2. package/lib/analyses/ControllerAnalyzer.js +12 -1
  3. package/lib/analyses/ControllerAnalyzer.js.map +1 -1
  4. package/lib/analyses/PathAnalyzer.d.ts +2 -2
  5. package/lib/analyses/PathAnalyzer.js +27 -11
  6. package/lib/analyses/PathAnalyzer.js.map +1 -1
  7. package/lib/analyses/ReflectAnalyzer.js +11 -2
  8. package/lib/analyses/ReflectAnalyzer.js.map +1 -1
  9. package/lib/executable/internal/NestiaConfigLoader.js +5 -1
  10. package/lib/executable/internal/NestiaConfigLoader.js.map +1 -1
  11. package/lib/executable/sdk.js +11 -11
  12. package/lib/generates/SwaggerGenerator.js +16 -22
  13. package/lib/generates/SwaggerGenerator.js.map +1 -1
  14. package/lib/generates/internal/SwaggerSchemaGenerator.js +22 -15
  15. package/lib/generates/internal/SwaggerSchemaGenerator.js.map +1 -1
  16. package/lib/structures/ISwaggerComponents.d.ts +1 -1
  17. package/lib/structures/ISwaggerRoute.d.ts +3 -3
  18. package/package.json +5 -5
  19. package/src/INestiaConfig.ts +248 -234
  20. package/src/NestiaSdkApplication.ts +253 -253
  21. package/src/analyses/AccessorAnalyzer.ts +60 -60
  22. package/src/analyses/ConfigAnalyzer.ts +147 -147
  23. package/src/analyses/ControllerAnalyzer.ts +390 -379
  24. package/src/analyses/ExceptionAnalyzer.ts +115 -115
  25. package/src/analyses/GenericAnalyzer.ts +51 -51
  26. package/src/analyses/ImportAnalyzer.ts +138 -138
  27. package/src/analyses/PathAnalyzer.ts +110 -98
  28. package/src/analyses/ReflectAnalyzer.ts +11 -6
  29. package/src/analyses/SecurityAnalyzer.ts +20 -20
  30. package/src/executable/internal/CommandParser.ts +15 -15
  31. package/src/executable/internal/NestiaConfigLoader.ts +67 -67
  32. package/src/executable/internal/NestiaSdkCommand.ts +60 -60
  33. package/src/executable/sdk.ts +73 -73
  34. package/src/generates/E2eGenerator.ts +64 -64
  35. package/src/generates/SdkGenerator.ts +96 -96
  36. package/src/generates/SwaggerGenerator.ts +376 -372
  37. package/src/generates/internal/E2eFileProgrammer.ts +123 -123
  38. package/src/generates/internal/SdkDistributionComposer.ts +91 -91
  39. package/src/generates/internal/SdkDtoGenerator.ts +424 -424
  40. package/src/generates/internal/SdkFileProgrammer.ts +106 -106
  41. package/src/generates/internal/SdkImportWizard.ts +55 -55
  42. package/src/generates/internal/SdkRouteDirectory.ts +17 -17
  43. package/src/generates/internal/SdkSimulationProgrammer.ts +133 -133
  44. package/src/generates/internal/SdkTypeDefiner.ts +119 -119
  45. package/src/generates/internal/SwaggerSchemaGenerator.ts +18 -2
  46. package/src/generates/internal/SwaggerSchemaValidator.ts +198 -198
  47. package/src/index.ts +4 -4
  48. package/src/module.ts +2 -2
  49. package/src/structures/IErrorReport.ts +6 -6
  50. package/src/structures/INestiaProject.ts +13 -13
  51. package/src/structures/INormalizedInput.ts +20 -20
  52. package/src/structures/ISwagger.ts +91 -91
  53. package/src/structures/ISwaggerComponents.ts +29 -29
  54. package/src/structures/ISwaggerError.ts +8 -8
  55. package/src/structures/ISwaggerInfo.ts +80 -80
  56. package/src/structures/ISwaggerLazyProperty.ts +7 -7
  57. package/src/structures/ISwaggerLazySchema.ts +7 -7
  58. package/src/structures/ISwaggerRoute.ts +51 -51
  59. package/src/structures/ISwaggerSecurityScheme.ts +65 -65
  60. package/src/structures/ITypeTuple.ts +6 -6
  61. package/src/structures/MethodType.ts +5 -5
  62. package/src/structures/ParamCategory.ts +1 -1
  63. package/src/structures/TypeEntry.ts +22 -22
  64. package/src/utils/ArrayUtil.ts +26 -26
  65. package/src/utils/FileRetriever.ts +22 -22
  66. package/src/utils/ImportDictionary.ts +125 -125
  67. package/src/utils/MapUtil.ts +14 -14
  68. package/src/utils/PathUtil.ts +10 -10
  69. package/src/utils/SourceFinder.ts +66 -66
  70. package/src/utils/StripEnums.ts +5 -5
@@ -1,66 +1,66 @@
1
- import fs from "fs";
2
- import glob from "glob";
3
- import path from "path";
4
-
5
- export namespace SourceFinder {
6
- interface IProps {
7
- exclude?: string[];
8
- include: string[];
9
- filter: (location: string) => Promise<boolean>;
10
- }
11
-
12
- export const find = async (props: IProps): Promise<string[]> => {
13
- const dict: Set<string> = new Set();
14
-
15
- await emplace(props.filter)(props.include)((str) => dict.add(str));
16
- if (props.exclude?.length)
17
- await emplace(props.filter)(props.exclude)((str) => dict.delete(str));
18
-
19
- return [...dict];
20
- };
21
-
22
- const emplace =
23
- (filter: (file: string) => Promise<boolean>) =>
24
- (input: string[]) =>
25
- async (closure: (location: string) => void): Promise<void> => {
26
- for (const pattern of input) {
27
- if (_Is_file(pattern)) {
28
- closure(path.resolve(pattern));
29
- continue;
30
- }
31
- for (const file of await _Glob(pattern)) {
32
- const stats: fs.Stats = await fs.promises.stat(file);
33
- if (stats.isDirectory() === true)
34
- await iterate(filter)(closure)(file);
35
- else if (stats.isFile() && (await filter(file))) closure(file);
36
- }
37
- }
38
- };
39
-
40
- const iterate =
41
- (filter: (location: string) => Promise<boolean>) =>
42
- (closure: (location: string) => void) =>
43
- async (location: string): Promise<void> => {
44
- const directory: string[] = await fs.promises.readdir(location);
45
- for (const file of directory) {
46
- const next: string = path.resolve(`${location}/${file}`);
47
- const stats: fs.Stats = await fs.promises.stat(next);
48
-
49
- if (stats.isDirectory() === true) await iterate(filter)(closure)(next);
50
- else if (stats.isFile() && (await filter(next))) closure(next);
51
- }
52
- };
53
-
54
- const _Glob = (pattern: string): Promise<string[]> =>
55
- new Promise((resolve, reject) => {
56
- glob(pattern, (err, matches) => {
57
- if (err) reject(err);
58
- else resolve(matches.map((str) => path.resolve(str)));
59
- });
60
- });
61
-
62
- const _Is_file = (pattern: string): boolean =>
63
- pattern.endsWith(".ts") &&
64
- !pattern.endsWith(".d.ts") &&
65
- fs.existsSync(pattern);
66
- }
1
+ import fs from "fs";
2
+ import glob from "glob";
3
+ import path from "path";
4
+
5
+ export namespace SourceFinder {
6
+ interface IProps {
7
+ exclude?: string[];
8
+ include: string[];
9
+ filter: (location: string) => Promise<boolean>;
10
+ }
11
+
12
+ export const find = async (props: IProps): Promise<string[]> => {
13
+ const dict: Set<string> = new Set();
14
+
15
+ await emplace(props.filter)(props.include)((str) => dict.add(str));
16
+ if (props.exclude?.length)
17
+ await emplace(props.filter)(props.exclude)((str) => dict.delete(str));
18
+
19
+ return [...dict];
20
+ };
21
+
22
+ const emplace =
23
+ (filter: (file: string) => Promise<boolean>) =>
24
+ (input: string[]) =>
25
+ async (closure: (location: string) => void): Promise<void> => {
26
+ for (const pattern of input) {
27
+ if (_Is_file(pattern)) {
28
+ closure(path.resolve(pattern));
29
+ continue;
30
+ }
31
+ for (const file of await _Glob(pattern)) {
32
+ const stats: fs.Stats = await fs.promises.stat(file);
33
+ if (stats.isDirectory() === true)
34
+ await iterate(filter)(closure)(file);
35
+ else if (stats.isFile() && (await filter(file))) closure(file);
36
+ }
37
+ }
38
+ };
39
+
40
+ const iterate =
41
+ (filter: (location: string) => Promise<boolean>) =>
42
+ (closure: (location: string) => void) =>
43
+ async (location: string): Promise<void> => {
44
+ const directory: string[] = await fs.promises.readdir(location);
45
+ for (const file of directory) {
46
+ const next: string = path.resolve(`${location}/${file}`);
47
+ const stats: fs.Stats = await fs.promises.stat(next);
48
+
49
+ if (stats.isDirectory() === true) await iterate(filter)(closure)(next);
50
+ else if (stats.isFile() && (await filter(next))) closure(next);
51
+ }
52
+ };
53
+
54
+ const _Glob = (pattern: string): Promise<string[]> =>
55
+ new Promise((resolve, reject) => {
56
+ glob(pattern, (err, matches) => {
57
+ if (err) reject(err);
58
+ else resolve(matches.map((str) => path.resolve(str)));
59
+ });
60
+ });
61
+
62
+ const _Is_file = (pattern: string): boolean =>
63
+ pattern.endsWith(".ts") &&
64
+ !pattern.endsWith(".d.ts") &&
65
+ fs.existsSync(pattern);
66
+ }
@@ -1,5 +1,5 @@
1
- export type StripEnums<T extends Record<string, any>> = {
2
- [Key in keyof T]: T[Key] extends string | boolean | object | undefined | any[]
3
- ? T[Key]
4
- : any;
5
- };
1
+ export type StripEnums<T extends Record<string, any>> = {
2
+ [Key in keyof T]: T[Key] extends string | boolean | object | undefined | any[]
3
+ ? T[Key]
4
+ : any;
5
+ };