@nestia/sdk 1.3.2 → 1.3.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 (51) hide show
  1. package/assets/config/nestia.config.ts +70 -70
  2. package/lib/INestiaConfig.d.ts +13 -0
  3. package/lib/executable/internal/NestiaSdkConfig.js +6 -2
  4. package/lib/executable/internal/NestiaSdkConfig.js.map +1 -1
  5. package/lib/executable/sdk.js +11 -11
  6. package/lib/generates/SwaggerGenerator.js +9 -9
  7. package/lib/generates/internal/DistributionComposer.js +1 -1
  8. package/lib/generates/internal/DistributionComposer.js.map +1 -1
  9. package/lib/generates/internal/E2eFileProgrammer.js +12 -12
  10. package/lib/generates/internal/SdkFileProgrammer.js +7 -5
  11. package/lib/generates/internal/SdkFileProgrammer.js.map +1 -1
  12. package/lib/generates/internal/SdkFunctionProgrammer.js +42 -49
  13. package/lib/generates/internal/SdkFunctionProgrammer.js.map +1 -1
  14. package/package.json +6 -4
  15. package/src/INestiaConfig.ts +204 -190
  16. package/src/NestiaSdkApplication.ts +262 -262
  17. package/src/analyses/ControllerAnalyzer.ts +261 -261
  18. package/src/analyses/GenericAnalyzer.ts +53 -53
  19. package/src/analyses/ImportAnalyzer.ts +164 -164
  20. package/src/analyses/PathAnalyzer.ts +58 -58
  21. package/src/analyses/ReflectAnalyzer.ts +321 -321
  22. package/src/executable/internal/CommandParser.ts +15 -15
  23. package/src/executable/internal/NestiaConfigCompilerOptions.ts +18 -18
  24. package/src/executable/internal/NestiaSdkCommand.ts +156 -156
  25. package/src/executable/internal/NestiaSdkConfig.ts +36 -36
  26. package/src/executable/internal/nestia.config.getter.ts +12 -12
  27. package/src/executable/sdk.ts +70 -70
  28. package/src/generates/E2eGenerator.ts +67 -67
  29. package/src/generates/SdkGenerator.ts +56 -56
  30. package/src/generates/SwaggerGenerator.ts +504 -504
  31. package/src/generates/internal/DistributionComposer.ts +98 -97
  32. package/src/generates/internal/E2eFileProgrammer.ts +135 -135
  33. package/src/generates/internal/SdkFileProgrammer.ts +150 -144
  34. package/src/generates/internal/SdkFunctionProgrammer.ts +51 -58
  35. package/src/generates/internal/SdkRouteDirectory.ts +21 -21
  36. package/src/index.ts +4 -4
  37. package/src/module.ts +2 -2
  38. package/src/structures/IController.ts +31 -31
  39. package/src/structures/IRoute.ts +39 -39
  40. package/src/structures/ISwaggerDocument.ts +120 -120
  41. package/src/structures/ITypeTuple.ts +6 -6
  42. package/src/structures/MethodType.ts +11 -11
  43. package/src/structures/ParamCategory.ts +1 -1
  44. package/src/structures/TypeEntry.ts +22 -22
  45. package/src/utils/ArrayUtil.ts +26 -26
  46. package/src/utils/FileRetriever.ts +22 -22
  47. package/src/utils/ImportDictionary.ts +56 -56
  48. package/src/utils/MapUtil.ts +14 -14
  49. package/src/utils/NestiaConfigUtil.ts +21 -21
  50. package/src/utils/SourceFinder.ts +60 -60
  51. package/src/utils/StripEnums.ts +10 -10
@@ -1,21 +1,21 @@
1
- import { INestiaConfig } from "../INestiaConfig";
2
-
3
- export namespace NestiaConfigUtil {
4
- export const input = (
5
- config: INestiaConfig["input"],
6
- ): INestiaConfig.IInput =>
7
- Array.isArray(config)
8
- ? {
9
- include: config,
10
- exclude: [],
11
- }
12
- : typeof config === "object"
13
- ? {
14
- include: config.include,
15
- exclude: config.exclude ?? [],
16
- }
17
- : {
18
- include: [config],
19
- exclude: [],
20
- };
21
- }
1
+ import { INestiaConfig } from "../INestiaConfig";
2
+
3
+ export namespace NestiaConfigUtil {
4
+ export const input = (
5
+ config: INestiaConfig["input"],
6
+ ): INestiaConfig.IInput =>
7
+ Array.isArray(config)
8
+ ? {
9
+ include: config,
10
+ exclude: [],
11
+ }
12
+ : typeof config === "object"
13
+ ? {
14
+ include: config.include,
15
+ exclude: config.exclude ?? [],
16
+ }
17
+ : {
18
+ include: [config],
19
+ exclude: [],
20
+ };
21
+ }
@@ -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
+ };