@nestia/sdk 2.3.0-dev.20231017-2 → 2.3.0-dev.20231017-5
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.
|
@@ -1,6 +1,34 @@
|
|
|
1
1
|
import { INestiaConfig } from "@nestia/sdk";
|
|
2
|
+
import { Module } from "@nestjs/common";
|
|
3
|
+
import { NestFactory } from "@nestjs/core";
|
|
2
4
|
|
|
3
5
|
export const NESTIA_CONFIG: INestiaConfig = {
|
|
6
|
+
/**
|
|
7
|
+
* Accessor of controller classes.
|
|
8
|
+
*
|
|
9
|
+
* You can specify it within two ways
|
|
10
|
+
*
|
|
11
|
+
* - Asynchronous function returning `INestApplication` instance
|
|
12
|
+
* - Specify the path or directory of controller class files
|
|
13
|
+
*/
|
|
14
|
+
input: async () => {
|
|
15
|
+
// change this to your own module
|
|
16
|
+
@Module({
|
|
17
|
+
controllers: [],
|
|
18
|
+
})
|
|
19
|
+
class MyModule {}
|
|
20
|
+
const app = await NestFactory.create(MyModule);
|
|
21
|
+
return app;
|
|
22
|
+
},
|
|
23
|
+
// input: "src/controllers",
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Output directory that SDK would be placed in.
|
|
27
|
+
*
|
|
28
|
+
* If not configured, you can't build the SDK library.
|
|
29
|
+
*/
|
|
30
|
+
output: "src/api",
|
|
31
|
+
|
|
4
32
|
/**
|
|
5
33
|
* Building `swagger.json` is also possible.
|
|
6
34
|
*
|
|
@@ -17,18 +45,6 @@ export const NESTIA_CONFIG: INestiaConfig = {
|
|
|
17
45
|
output: "dist/swagger.json",
|
|
18
46
|
},
|
|
19
47
|
|
|
20
|
-
/**
|
|
21
|
-
* List of files or directories containing the NestJS controller classes.
|
|
22
|
-
*/
|
|
23
|
-
input: "src/controllers",
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Output directory that SDK would be placed in.
|
|
27
|
-
*
|
|
28
|
-
* If not configured, you can't build the SDK library.
|
|
29
|
-
*/
|
|
30
|
-
output: "src/api",
|
|
31
|
-
|
|
32
48
|
/**
|
|
33
49
|
* Target directory that SDK distribution files would be placed in.
|
|
34
50
|
*
|
package/lib/INestiaConfig.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export interface INestiaConfig {
|
|
|
19
19
|
*
|
|
20
20
|
* You can specify it within two ways
|
|
21
21
|
*
|
|
22
|
-
* -
|
|
22
|
+
* - Asynchronous function returning `INestApplication` instance
|
|
23
23
|
* - Specify the path or directory of controller class files
|
|
24
24
|
*/
|
|
25
25
|
input: string | string[] | INestiaConfig.IInput | (() => Promise<INestApplication>);
|
|
@@ -36,6 +36,7 @@ var ConfigAnalyzer;
|
|
|
36
36
|
});
|
|
37
37
|
const application = (app) => __awaiter(this, void 0, void 0, function* () {
|
|
38
38
|
var _a, _b, _c, _d;
|
|
39
|
+
const cwd = process.cwd();
|
|
39
40
|
const files = yield (() => __awaiter(this, void 0, void 0, function* () {
|
|
40
41
|
var _e, _f;
|
|
41
42
|
const functions = new Set();
|
|
@@ -46,8 +47,14 @@ var ConfigAnalyzer;
|
|
|
46
47
|
for (const f of functions)
|
|
47
48
|
files.add((_f = (_e = (yield require("get-function-location")(f))) === null || _e === void 0 ? void 0 : _e.source) !== null && _f !== void 0 ? _f : "");
|
|
48
49
|
return [...files]
|
|
49
|
-
.
|
|
50
|
-
|
|
50
|
+
.map((str) => str.substring(str.startsWith("file:///")
|
|
51
|
+
? cwd[0] === "/"
|
|
52
|
+
? 7
|
|
53
|
+
: 8
|
|
54
|
+
: str.startsWith("file://")
|
|
55
|
+
? 7
|
|
56
|
+
: 0))
|
|
57
|
+
.filter((str) => !!str.length);
|
|
51
58
|
}))();
|
|
52
59
|
const versioning = (_a = app.config) === null || _a === void 0 ? void 0 : _a.versioningOptions;
|
|
53
60
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigAnalyzer.js","sourceRoot":"","sources":["../../src/analyses/ConfigAnalyzer.ts"],"names":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,CAAC,CAAC;oBACI,MAAM,EACF,UAAU,CAAC,MAAM,KAAK,SAAS;wBAC/B,UAAU,CAAC,MAAM,KAAK,KAAK;wBACvB,CAAC,CAAC,GAAG;wBACL,CAAC,CAAC,UAAU,CAAC,MAAM;iBAC9B;SACd,CAAC;IACN,CAAC,CAAA,CAAC;AACN,CAAC,EA5EgB,cAAc,8BAAd,cAAc,QA4E9B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestia/sdk",
|
|
3
|
-
"version": "2.3.0-dev.20231017-
|
|
3
|
+
"version": "2.3.0-dev.20231017-5",
|
|
4
4
|
"description": "Nestia SDK and Swagger generator",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
},
|
|
36
36
|
"homepage": "https://nestia.io",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@nestia/fetcher": "^2.3.0-dev.20231017-
|
|
38
|
+
"@nestia/fetcher": "^2.3.0-dev.20231017-5",
|
|
39
39
|
"cli": "^1.0.1",
|
|
40
40
|
"get-function-location": "^2.0.0",
|
|
41
41
|
"glob": "^7.2.0",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"typia": ">=5.2.2 <6.0.0"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"@nestia/fetcher": ">=2.3.0-dev.20231017-
|
|
51
|
+
"@nestia/fetcher": ">=2.3.0-dev.20231017-5",
|
|
52
52
|
"@nestjs/common": ">=7.0.1",
|
|
53
53
|
"@nestjs/core": ">=7.0.1",
|
|
54
54
|
"reflect-metadata": ">=0.1.12",
|
package/src/INestiaConfig.ts
CHANGED
|
@@ -23,7 +23,7 @@ export interface INestiaConfig {
|
|
|
23
23
|
*
|
|
24
24
|
* You can specify it within two ways
|
|
25
25
|
*
|
|
26
|
-
* -
|
|
26
|
+
* - Asynchronous function returning `INestApplication` instance
|
|
27
27
|
* - Specify the path or directory of controller class files
|
|
28
28
|
*/
|
|
29
29
|
input:
|
|
@@ -27,6 +27,7 @@ export namespace ConfigAnalyzer {
|
|
|
27
27
|
const application = async (
|
|
28
28
|
app: INestApplication,
|
|
29
29
|
): Promise<INestiaConfig.IInput> => {
|
|
30
|
+
const cwd: string = process.cwd();
|
|
30
31
|
const files: string[] = await (async () => {
|
|
31
32
|
const functions = new Set<Function>();
|
|
32
33
|
for (const module of (app as any).container.modules.values())
|
|
@@ -38,13 +39,20 @@ export namespace ConfigAnalyzer {
|
|
|
38
39
|
(await require("get-function-location")(f))?.source ?? "",
|
|
39
40
|
);
|
|
40
41
|
return [...files]
|
|
41
|
-
.filter((str) => str.startsWith("file://"))
|
|
42
42
|
.map((str) =>
|
|
43
|
-
str.substring(
|
|
44
|
-
|
|
43
|
+
str.substring(
|
|
44
|
+
str.startsWith("file:///")
|
|
45
|
+
? cwd[0] === "/"
|
|
46
|
+
? 7
|
|
47
|
+
: 8
|
|
48
|
+
: str.startsWith("file://")
|
|
49
|
+
? 7
|
|
50
|
+
: 0,
|
|
51
|
+
),
|
|
52
|
+
)
|
|
53
|
+
.filter((str) => !!str.length);
|
|
45
54
|
})();
|
|
46
55
|
const versioning = (app as any).config?.versioningOptions;
|
|
47
|
-
|
|
48
56
|
return {
|
|
49
57
|
include: files,
|
|
50
58
|
exclude: [],
|