@nestia/sdk 11.0.0-dev.20260312 → 11.0.0-dev.20260313-3

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 (50) hide show
  1. package/assets/bundle/distribute/package.json +1 -1
  2. package/lib/executable/sdk.js +12 -12
  3. package/package.json +8 -8
  4. package/src/analyses/ConfigAnalyzer.ts +155 -155
  5. package/src/analyses/ExceptionAnalyzer.ts +154 -154
  6. package/src/analyses/GenericAnalyzer.ts +49 -49
  7. package/src/analyses/PathAnalyzer.ts +69 -69
  8. package/src/analyses/ReflectControllerAnalyzer.ts +105 -105
  9. package/src/analyses/ReflectMetadataAnalyzer.ts +44 -44
  10. package/src/analyses/ReflectWebSocketOperationAnalyzer.ts +172 -172
  11. package/src/analyses/SecurityAnalyzer.ts +25 -25
  12. package/src/analyses/TypedWebSocketRouteAnalyzer.ts +33 -33
  13. package/src/decorators/OperationMetadata.ts +15 -15
  14. package/src/executable/internal/CommandParser.ts +15 -15
  15. package/src/executable/sdk.ts +75 -75
  16. package/src/generates/CloneGenerator.ts +66 -66
  17. package/src/generates/E2eGenerator.ts +32 -32
  18. package/src/generates/SdkGenerator.ts +160 -160
  19. package/src/generates/internal/SdkDistributionComposer.ts +103 -103
  20. package/src/generates/internal/SdkHttpParameterProgrammer.ts +178 -178
  21. package/src/generates/internal/SdkRouteDirectory.ts +18 -18
  22. package/src/generates/internal/SdkWebSocketParameterProgrammer.ts +87 -87
  23. package/src/generates/internal/SwaggerDescriptionComposer.ts +64 -64
  24. package/src/index.ts +4 -4
  25. package/src/structures/INestiaProject.ts +13 -13
  26. package/src/structures/INestiaSdkInput.ts +20 -20
  27. package/src/structures/IReflectApplication.ts +8 -8
  28. package/src/structures/IReflectController.ts +15 -15
  29. package/src/structures/IReflectHttpOperation.ts +26 -26
  30. package/src/structures/IReflectImport.ts +6 -6
  31. package/src/structures/IReflectOperationError.ts +26 -26
  32. package/src/structures/IReflectType.ts +4 -4
  33. package/src/structures/IReflectWebSocketOperation.ts +17 -17
  34. package/src/structures/IReflectWebSocketOperationParameter.ts +36 -36
  35. package/src/structures/ITypedHttpRoute.ts +41 -41
  36. package/src/structures/ITypedWebSocketRoute.ts +24 -24
  37. package/src/structures/ITypedWebSocketRouteParameter.ts +3 -3
  38. package/src/structures/MethodType.ts +5 -5
  39. package/src/structures/ParamCategory.ts +1 -1
  40. package/src/structures/TypeEntry.ts +22 -22
  41. package/src/transform.ts +9 -9
  42. package/src/typings/get-function-location.d.ts +7 -7
  43. package/src/utils/ArrayUtil.ts +26 -26
  44. package/src/utils/FileRetriever.ts +22 -22
  45. package/src/utils/MapUtil.ts +14 -14
  46. package/src/utils/PathUtil.ts +10 -10
  47. package/src/utils/SourceFinder.ts +63 -63
  48. package/src/utils/StringUtil.ts +17 -17
  49. package/src/utils/StripEnums.ts +5 -5
  50. package/src/utils/VersioningStrategy.ts +28 -28
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ORGANIZATION/PROJECT-api",
3
- "version": "11.0.0-dev.20260312",
3
+ "version": "11.0.0-dev.20260313-3",
4
4
  "description": "SDK library generated by Nestia",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
@@ -50,18 +50,18 @@ const child_process_1 = __importDefault(require("child_process"));
50
50
  const fs_1 = __importDefault(require("fs"));
51
51
  const process_1 = __importDefault(require("process"));
52
52
  const CommandParser_1 = require("./internal/CommandParser");
53
- const USAGE = `Wrong command has been detected. Use like below:
54
-
55
- npx @nestia/sdk [command] [options?]
56
-
57
- 1. npx @nestia/sdk dependencies --manager (npm|pnpm|yarn)
58
- - npx @nestia/sdk dependencies
59
- - npx @nestia/sdk dependencies --manager pnpm
60
- 2. npx @nestia/sdk init
61
- 3. npx @nestia/sdk sdk --config? [config file] --project? [project file]
62
- 4. npx @nestia/sdk swagger --config? [config file] --project? [project file]
63
- 5. npx @nestia/sdk e2e --config? [config file] --project? [project file]
64
- 6. npx @nestia/sdk generate --config? [config file] --project? [project file]
53
+ const USAGE = `Wrong command has been detected. Use like below:
54
+
55
+ npx @nestia/sdk [command] [options?]
56
+
57
+ 1. npx @nestia/sdk dependencies --manager (npm|pnpm|yarn)
58
+ - npx @nestia/sdk dependencies
59
+ - npx @nestia/sdk dependencies --manager pnpm
60
+ 2. npx @nestia/sdk init
61
+ 3. npx @nestia/sdk sdk --config? [config file] --project? [project file]
62
+ 4. npx @nestia/sdk swagger --config? [config file] --project? [project file]
63
+ 5. npx @nestia/sdk e2e --config? [config file] --project? [project file]
64
+ 6. npx @nestia/sdk generate --config? [config file] --project? [project file]
65
65
  `;
66
66
  function halt(desc) {
67
67
  console.error(desc);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestia/sdk",
3
- "version": "11.0.0-dev.20260312",
3
+ "version": "11.0.0-dev.20260313-3",
4
4
  "description": "Nestia SDK and Swagger generator",
5
5
  "main": "lib/index.js",
6
6
  "exports": {
@@ -45,9 +45,9 @@
45
45
  },
46
46
  "homepage": "https://nestia.io",
47
47
  "dependencies": {
48
- "@typia/core": "12.0.0-dev.20260312-2",
49
- "@typia/interface": "12.0.0-dev.20260312-2",
50
- "@typia/utils": "12.0.0-dev.20260312-2",
48
+ "@typia/core": "12.0.0-dev.20260313",
49
+ "@typia/interface": "12.0.0-dev.20260313",
50
+ "@typia/utils": "12.0.0-dev.20260313",
51
51
  "cli": "^1.0.1",
52
52
  "get-function-location": "^2.0.0",
53
53
  "glob": "^11.0.3",
@@ -57,12 +57,12 @@
57
57
  "tsconfck": "^2.1.2",
58
58
  "tsconfig-paths": "^4.1.1",
59
59
  "tstl": "^3.0.0",
60
- "typia": "12.0.0-dev.20260312-2",
61
- "@nestia/core": "^11.0.0-dev.20260312",
62
- "@nestia/fetcher": "^11.0.0-dev.20260312"
60
+ "typia": "12.0.0-dev.20260313",
61
+ "@nestia/core": "^11.0.0-dev.20260313-3",
62
+ "@nestia/fetcher": "^11.0.0-dev.20260313-3"
63
63
  },
64
64
  "peerDependencies": {
65
- "@nestia/core": "^11.0.0-dev.20260312"
65
+ "@nestia/core": "^11.0.0-dev.20260313-3"
66
66
  },
67
67
  "devDependencies": {
68
68
  "@nestjs/common": "^11.1.4",
@@ -1,155 +1,155 @@
1
- /// <reference path="../typings/get-function-location.d.ts" />
2
- import { INestApplication, VersioningType } from "@nestjs/common";
3
- import { MODULE_PATH } from "@nestjs/common/constants";
4
- import { NestContainer } from "@nestjs/core";
5
- import { Module } from "@nestjs/core/injector/module";
6
- import fs from "fs";
7
- import getFunctionLocation from "get-function-location";
8
- import path from "path";
9
- import { HashMap, Pair, Singleton } from "tstl";
10
-
11
- import { INestiaConfig } from "../INestiaConfig";
12
- import { SdkGenerator } from "../generates/SdkGenerator";
13
- import { INestiaSdkInput } from "../structures/INestiaSdkInput";
14
- import { ArrayUtil } from "../utils/ArrayUtil";
15
- import { MapUtil } from "../utils/MapUtil";
16
- import { SourceFinder } from "../utils/SourceFinder";
17
-
18
- export namespace ConfigAnalyzer {
19
- export const input = async (
20
- config: INestiaConfig,
21
- ): Promise<INestiaSdkInput> => {
22
- return MapUtil.take(memory, config, async () => {
23
- if (typeof config.input === "function")
24
- return application(await config.input());
25
-
26
- const sources: string[] = await SourceFinder.find({
27
- include: Array.isArray(config.input)
28
- ? config.input
29
- : typeof config.input === "object"
30
- ? config.input.include
31
- : [config.input],
32
- exclude:
33
- typeof config.input === "object" && !Array.isArray(config.input)
34
- ? (config.input.exclude ?? [])
35
- : [],
36
- filter: filter(config),
37
- });
38
- const controllers: INestiaSdkInput.IController[] = [];
39
- for (const file of sources) {
40
- const external: any[] = await import(file);
41
- for (const key in external) {
42
- const instance: Function = external[key];
43
- if (Reflect.getMetadata("path", instance) !== undefined)
44
- controllers.push({
45
- class: instance,
46
- location: file,
47
- prefixes: [],
48
- });
49
- }
50
- }
51
- return {
52
- controllers,
53
- };
54
- });
55
- };
56
-
57
- export const application = async (
58
- app: INestApplication,
59
- ): Promise<INestiaSdkInput> => {
60
- const container: NestContainer = (app as any).container as NestContainer;
61
- const modules: Module[] = [...container.getModules().values()].filter(
62
- (m) => !!m.controllers.size,
63
- );
64
- const unique: HashMap<Function, Set<string>> = new HashMap();
65
-
66
- for (const m of modules) {
67
- const path: string =
68
- Reflect.getMetadata(
69
- MODULE_PATH + container.getModules().applicationId,
70
- m.metatype,
71
- ) ??
72
- Reflect.getMetadata(MODULE_PATH, m.metatype) ??
73
- "";
74
- for (const controller of [...m.controllers.keys()])
75
- if (typeof controller === "function")
76
- unique.take(controller, () => new Set()).add(path);
77
- }
78
- const controllers: INestiaSdkInput.IController[] = [];
79
- for (const it of unique) {
80
- const file: string | null =
81
- (await getFunctionLocation(it.first))?.source ?? null;
82
- if (file === null) continue;
83
- const location: string = normalize_file(file);
84
- if (location.length === 0) continue;
85
- controllers.push({
86
- class: it.first,
87
- prefixes: Array.from(it.second),
88
- location,
89
- });
90
- }
91
-
92
- const versioning = (app as any).config?.versioningOptions;
93
- return {
94
- controllers,
95
- globalPrefix:
96
- typeof (app as any).config?.globalPrefix === "string"
97
- ? {
98
- prefix: (app as any).config.globalPrefix,
99
- exclude: (app as any).config.globalPrefixOptions?.exclude ?? {},
100
- }
101
- : undefined,
102
- versioning:
103
- versioning === undefined || versioning.type !== VersioningType.URI
104
- ? undefined
105
- : {
106
- prefix:
107
- versioning.prefix === undefined || versioning.prefix === false
108
- ? "v"
109
- : versioning.prefix,
110
- defaultVersion: versioning.defaultVersion,
111
- },
112
- };
113
- };
114
- }
115
- const memory = new Map<INestiaConfig, Promise<INestiaSdkInput>>();
116
- const normalize_file = (str: string) =>
117
- str.substring(
118
- str.startsWith("file:///")
119
- ? process.cwd()[0] === "/"
120
- ? 7
121
- : 8
122
- : str.startsWith("file://")
123
- ? 7
124
- : 0,
125
- );
126
-
127
- const filter =
128
- (config: INestiaConfig) =>
129
- async (location: string): Promise<boolean> =>
130
- location.endsWith(".ts") &&
131
- !location.endsWith(".d.ts") &&
132
- (config.output === undefined ||
133
- (location.indexOf(path.join(config.output, "functional")) === -1 &&
134
- (await (
135
- await bundler.get(config.output)
136
- )(location))) === false);
137
-
138
- const bundler = new Singleton(async (output: string) => {
139
- const assets: string[] = await fs.promises.readdir(SdkGenerator.BUNDLE_PATH);
140
- const tuples: Pair<string, boolean>[] = await ArrayUtil.asyncMap(
141
- assets,
142
- async (file) => {
143
- const relative: string = path.join(output, file);
144
- const location: string = path.join(SdkGenerator.BUNDLE_PATH, file);
145
- const stats: fs.Stats = await fs.promises.stat(location);
146
- return new Pair(relative, stats.isDirectory());
147
- },
148
- );
149
- return async (file: string): Promise<boolean> => {
150
- for (const it of tuples)
151
- if (it.second === false && file === it.first) return true;
152
- else if (it.second === true && file.indexOf(it.first) === 0) return true;
153
- return false;
154
- };
155
- });
1
+ /// <reference path="../typings/get-function-location.d.ts" />
2
+ import { INestApplication, VersioningType } from "@nestjs/common";
3
+ import { MODULE_PATH } from "@nestjs/common/constants";
4
+ import { NestContainer } from "@nestjs/core";
5
+ import { Module } from "@nestjs/core/injector/module";
6
+ import fs from "fs";
7
+ import getFunctionLocation from "get-function-location";
8
+ import path from "path";
9
+ import { HashMap, Pair, Singleton } from "tstl";
10
+
11
+ import { INestiaConfig } from "../INestiaConfig";
12
+ import { SdkGenerator } from "../generates/SdkGenerator";
13
+ import { INestiaSdkInput } from "../structures/INestiaSdkInput";
14
+ import { ArrayUtil } from "../utils/ArrayUtil";
15
+ import { MapUtil } from "../utils/MapUtil";
16
+ import { SourceFinder } from "../utils/SourceFinder";
17
+
18
+ export namespace ConfigAnalyzer {
19
+ export const input = async (
20
+ config: INestiaConfig,
21
+ ): Promise<INestiaSdkInput> => {
22
+ return MapUtil.take(memory, config, async () => {
23
+ if (typeof config.input === "function")
24
+ return application(await config.input());
25
+
26
+ const sources: string[] = await SourceFinder.find({
27
+ include: Array.isArray(config.input)
28
+ ? config.input
29
+ : typeof config.input === "object"
30
+ ? config.input.include
31
+ : [config.input],
32
+ exclude:
33
+ typeof config.input === "object" && !Array.isArray(config.input)
34
+ ? (config.input.exclude ?? [])
35
+ : [],
36
+ filter: filter(config),
37
+ });
38
+ const controllers: INestiaSdkInput.IController[] = [];
39
+ for (const file of sources) {
40
+ const external: any[] = await import(file);
41
+ for (const key in external) {
42
+ const instance: Function = external[key];
43
+ if (Reflect.getMetadata("path", instance) !== undefined)
44
+ controllers.push({
45
+ class: instance,
46
+ location: file,
47
+ prefixes: [],
48
+ });
49
+ }
50
+ }
51
+ return {
52
+ controllers,
53
+ };
54
+ });
55
+ };
56
+
57
+ export const application = async (
58
+ app: INestApplication,
59
+ ): Promise<INestiaSdkInput> => {
60
+ const container: NestContainer = (app as any).container as NestContainer;
61
+ const modules: Module[] = [...container.getModules().values()].filter(
62
+ (m) => !!m.controllers.size,
63
+ );
64
+ const unique: HashMap<Function, Set<string>> = new HashMap();
65
+
66
+ for (const m of modules) {
67
+ const path: string =
68
+ Reflect.getMetadata(
69
+ MODULE_PATH + container.getModules().applicationId,
70
+ m.metatype,
71
+ ) ??
72
+ Reflect.getMetadata(MODULE_PATH, m.metatype) ??
73
+ "";
74
+ for (const controller of [...m.controllers.keys()])
75
+ if (typeof controller === "function")
76
+ unique.take(controller, () => new Set()).add(path);
77
+ }
78
+ const controllers: INestiaSdkInput.IController[] = [];
79
+ for (const it of unique) {
80
+ const file: string | null =
81
+ (await getFunctionLocation(it.first))?.source ?? null;
82
+ if (file === null) continue;
83
+ const location: string = normalize_file(file);
84
+ if (location.length === 0) continue;
85
+ controllers.push({
86
+ class: it.first,
87
+ prefixes: Array.from(it.second),
88
+ location,
89
+ });
90
+ }
91
+
92
+ const versioning = (app as any).config?.versioningOptions;
93
+ return {
94
+ controllers,
95
+ globalPrefix:
96
+ typeof (app as any).config?.globalPrefix === "string"
97
+ ? {
98
+ prefix: (app as any).config.globalPrefix,
99
+ exclude: (app as any).config.globalPrefixOptions?.exclude ?? {},
100
+ }
101
+ : undefined,
102
+ versioning:
103
+ versioning === undefined || versioning.type !== VersioningType.URI
104
+ ? undefined
105
+ : {
106
+ prefix:
107
+ versioning.prefix === undefined || versioning.prefix === false
108
+ ? "v"
109
+ : versioning.prefix,
110
+ defaultVersion: versioning.defaultVersion,
111
+ },
112
+ };
113
+ };
114
+ }
115
+ const memory = new Map<INestiaConfig, Promise<INestiaSdkInput>>();
116
+ const normalize_file = (str: string) =>
117
+ str.substring(
118
+ str.startsWith("file:///")
119
+ ? process.cwd()[0] === "/"
120
+ ? 7
121
+ : 8
122
+ : str.startsWith("file://")
123
+ ? 7
124
+ : 0,
125
+ );
126
+
127
+ const filter =
128
+ (config: INestiaConfig) =>
129
+ async (location: string): Promise<boolean> =>
130
+ location.endsWith(".ts") &&
131
+ !location.endsWith(".d.ts") &&
132
+ (config.output === undefined ||
133
+ (location.indexOf(path.join(config.output, "functional")) === -1 &&
134
+ (await (
135
+ await bundler.get(config.output)
136
+ )(location))) === false);
137
+
138
+ const bundler = new Singleton(async (output: string) => {
139
+ const assets: string[] = await fs.promises.readdir(SdkGenerator.BUNDLE_PATH);
140
+ const tuples: Pair<string, boolean>[] = await ArrayUtil.asyncMap(
141
+ assets,
142
+ async (file) => {
143
+ const relative: string = path.join(output, file);
144
+ const location: string = path.join(SdkGenerator.BUNDLE_PATH, file);
145
+ const stats: fs.Stats = await fs.promises.stat(location);
146
+ return new Pair(relative, stats.isDirectory());
147
+ },
148
+ );
149
+ return async (file: string): Promise<boolean> => {
150
+ for (const it of tuples)
151
+ if (it.second === false && file === it.first) return true;
152
+ else if (it.second === true && file.indexOf(it.first) === 0) return true;
153
+ return false;
154
+ };
155
+ });