@biuxiu/codegen 0.2.12 → 0.2.13
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/format/api.js +10 -1
- package/dist/libs/nest-lib.d.ts +2 -2
- package/dist/libs/nest-lib.js +1 -1
- package/dist/lua_codegen_bg.wasm +0 -0
- package/dist/types.d.ts +1 -0
- package/package.json +1 -1
package/dist/format/api.js
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
import { BaseFormat } from "./base";
|
2
2
|
class ApiFormat extends BaseFormat {
|
3
3
|
#hasInterceptor = false;
|
4
|
+
#isNoAuth = false;
|
4
5
|
#moudleName;
|
5
6
|
#upperName;
|
6
7
|
#apiMap = {};
|
@@ -11,7 +12,7 @@ class ApiFormat extends BaseFormat {
|
|
11
12
|
this.#upperName = moduleName[0].toUpperCase() + moduleName.slice(1);
|
12
13
|
}
|
13
14
|
formatOnceStep() {
|
14
|
-
const { key, interceptor } = this.getCurSchema();
|
15
|
+
const { key, interceptor, noAuth } = this.getCurSchema();
|
15
16
|
if (this.#apiMap[key]) {
|
16
17
|
return;
|
17
18
|
}
|
@@ -20,6 +21,10 @@ class ApiFormat extends BaseFormat {
|
|
20
21
|
this.#hasInterceptor = true;
|
21
22
|
this.content += "\n@UseInterceptors(ClassSerializerInterceptor)\n";
|
22
23
|
}
|
24
|
+
if (noAuth) {
|
25
|
+
this.#isNoAuth = true;
|
26
|
+
this.content += "\n@NoAuthToken()\n";
|
27
|
+
}
|
23
28
|
if (key === "get") {
|
24
29
|
this.content += `
|
25
30
|
@Get(':id')
|
@@ -86,6 +91,10 @@ class ApiFormat extends BaseFormat {
|
|
86
91
|
if (this.#apiMap["add"] || this.#apiMap["update"]) {
|
87
92
|
this.#importCommon += "Body,";
|
88
93
|
}
|
94
|
+
if (this.#isNoAuth) {
|
95
|
+
this.importInfo += `import { NoAuthToken } from '@api/common/utils/passport'
|
96
|
+
`;
|
97
|
+
}
|
89
98
|
if (this.#hasInterceptor) {
|
90
99
|
this.#importCommon += "UseInterceptors,ClassSerializerInterceptor,";
|
91
100
|
}
|
package/dist/libs/nest-lib.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { ApiServiceField, DtoField, EntityField } from '../types';
|
2
|
-
export declare function renderNestCode(
|
2
|
+
export declare function renderNestCode(config: {
|
3
3
|
name: string;
|
4
4
|
path?: string;
|
5
|
-
}): void;
|
5
|
+
}, entity: EntityField[], dto: DtoField[], apiService: ApiServiceField[]): void;
|
package/dist/libs/nest-lib.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { RenderNest } from "../code/nest";
|
2
2
|
import { isReverse } from "../config";
|
3
|
-
function renderNestCode(entity, dto, apiService
|
3
|
+
function renderNestCode(config, entity, dto, apiService) {
|
4
4
|
const api = new RenderNest(config.name, config.path);
|
5
5
|
if (isReverse()) {
|
6
6
|
api.remove();
|
package/dist/lua_codegen_bg.wasm
CHANGED
Binary file
|
package/dist/types.d.ts
CHANGED