@nestia/sdk 2.4.3-dev.20231207 → 3.0.0-dev.20231209

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 (64) hide show
  1. package/lib/analyses/ReflectAnalyzer.js +1 -1
  2. package/lib/analyses/ReflectAnalyzer.js.map +1 -1
  3. package/lib/executable/sdk.js +11 -11
  4. package/lib/generates/internal/SdkFunctionProgrammer.js +2 -2
  5. package/lib/generates/internal/SdkFunctionProgrammer.js.map +1 -1
  6. package/lib/generates/internal/SwaggerSchemaGenerator.js.map +1 -1
  7. package/lib/structures/IController.d.ts +1 -1
  8. package/lib/structures/IRoute.d.ts +1 -1
  9. package/package.json +3 -3
  10. package/src/INestiaConfig.ts +234 -234
  11. package/src/NestiaSdkApplication.ts +253 -253
  12. package/src/analyses/AccessorAnalyzer.ts +60 -60
  13. package/src/analyses/ConfigAnalyzer.ts +147 -147
  14. package/src/analyses/ControllerAnalyzer.ts +379 -379
  15. package/src/analyses/ExceptionAnalyzer.ts +115 -115
  16. package/src/analyses/GenericAnalyzer.ts +51 -51
  17. package/src/analyses/ImportAnalyzer.ts +138 -138
  18. package/src/analyses/PathAnalyzer.ts +98 -98
  19. package/src/analyses/ReflectAnalyzer.ts +1 -1
  20. package/src/analyses/SecurityAnalyzer.ts +20 -20
  21. package/src/executable/internal/CommandParser.ts +15 -15
  22. package/src/executable/internal/NestiaConfigLoader.ts +67 -67
  23. package/src/executable/internal/NestiaSdkCommand.ts +60 -60
  24. package/src/executable/sdk.ts +73 -73
  25. package/src/generates/E2eGenerator.ts +64 -64
  26. package/src/generates/SdkGenerator.ts +96 -96
  27. package/src/generates/SwaggerGenerator.ts +372 -372
  28. package/src/generates/internal/E2eFileProgrammer.ts +123 -123
  29. package/src/generates/internal/SdkDistributionComposer.ts +91 -91
  30. package/src/generates/internal/SdkDtoGenerator.ts +424 -424
  31. package/src/generates/internal/SdkFileProgrammer.ts +106 -106
  32. package/src/generates/internal/SdkFunctionProgrammer.ts +2 -2
  33. package/src/generates/internal/SdkImportWizard.ts +55 -55
  34. package/src/generates/internal/SdkRouteDirectory.ts +17 -17
  35. package/src/generates/internal/SdkSimulationProgrammer.ts +133 -133
  36. package/src/generates/internal/SdkTypeDefiner.ts +119 -119
  37. package/src/generates/internal/SwaggerSchemaGenerator.ts +22 -23
  38. package/src/generates/internal/SwaggerSchemaValidator.ts +198 -198
  39. package/src/index.ts +4 -4
  40. package/src/module.ts +2 -2
  41. package/src/structures/IController.ts +5 -1
  42. package/src/structures/IErrorReport.ts +6 -6
  43. package/src/structures/INestiaProject.ts +13 -13
  44. package/src/structures/INormalizedInput.ts +20 -20
  45. package/src/structures/IRoute.ts +2 -1
  46. package/src/structures/ISwagger.ts +91 -91
  47. package/src/structures/ISwaggerComponents.ts +29 -29
  48. package/src/structures/ISwaggerError.ts +8 -8
  49. package/src/structures/ISwaggerInfo.ts +80 -80
  50. package/src/structures/ISwaggerLazyProperty.ts +7 -7
  51. package/src/structures/ISwaggerLazySchema.ts +7 -7
  52. package/src/structures/ISwaggerRoute.ts +51 -51
  53. package/src/structures/ISwaggerSecurityScheme.ts +65 -65
  54. package/src/structures/ITypeTuple.ts +6 -6
  55. package/src/structures/MethodType.ts +5 -5
  56. package/src/structures/ParamCategory.ts +1 -1
  57. package/src/structures/TypeEntry.ts +22 -22
  58. package/src/utils/ArrayUtil.ts +26 -26
  59. package/src/utils/FileRetriever.ts +22 -22
  60. package/src/utils/ImportDictionary.ts +125 -125
  61. package/src/utils/MapUtil.ts +14 -14
  62. package/src/utils/PathUtil.ts +10 -10
  63. package/src/utils/SourceFinder.ts +66 -66
  64. 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
+ };