@lark-apaas/fullstack-nestjs-core 1.1.1 → 1.1.2-alpha.10
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.
- package/dist/index.cjs +28480 -21
- package/dist/index.d.cts +24 -1
- package/dist/index.d.ts +24 -1
- package/dist/index.js +28490 -5
- package/package.json +3 -2
package/dist/index.d.cts
CHANGED
|
@@ -19,6 +19,10 @@ declare global {
|
|
|
19
19
|
tenantId?: number;
|
|
20
20
|
appId?: string;
|
|
21
21
|
loginUrl?: string;
|
|
22
|
+
env?: 'preview' | 'runtime';
|
|
23
|
+
userName?: string; // 默认中文名
|
|
24
|
+
userNameEn?: string; // 冗余一份英文名
|
|
25
|
+
userNameI18n?: Record<string, string>; // 带多语的用户名
|
|
22
26
|
},
|
|
23
27
|
csrfToken?: string;
|
|
24
28
|
}
|
|
@@ -92,4 +96,23 @@ declare class ViewContextMiddleware implements NestMiddleware {
|
|
|
92
96
|
use(req: Request, res: Response, next: NextFunction): void;
|
|
93
97
|
}
|
|
94
98
|
|
|
95
|
-
|
|
99
|
+
/**
|
|
100
|
+
* API 404 兜底 Controller
|
|
101
|
+
*
|
|
102
|
+
* 处理所有未匹配的 /api/* 路径,返回标准的 JSON 404 响应
|
|
103
|
+
*
|
|
104
|
+
* 工作原理:
|
|
105
|
+
* NestJS 会根据路由的具体程度自动排序:
|
|
106
|
+
* 1. 具体路径 (/api/users) - 最高优先级
|
|
107
|
+
* 2. 路径参数 (/api/:id)
|
|
108
|
+
* 3. 通配符 (/api/*) - 本 Controller
|
|
109
|
+
* 4. 更宽泛的通配符 (/*) - ViewModule
|
|
110
|
+
*
|
|
111
|
+
* 因此即使 PlatformModule 在其他业务模块之前导入,
|
|
112
|
+
* 具体的 API 路由仍然会优先匹配,不会被拦截。
|
|
113
|
+
*/
|
|
114
|
+
declare class ApiFallbackController {
|
|
115
|
+
handleNotFound(req: Request, res: Response): Response<any, Record<string, any>>;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export { ApiFallbackController, CsrfMiddleware, CsrfTokenMiddleware, PlatformModule, type PlatformModuleOptions, UserContextMiddleware, ViewContextMiddleware, configureApp };
|
package/dist/index.d.ts
CHANGED
|
@@ -19,6 +19,10 @@ declare global {
|
|
|
19
19
|
tenantId?: number;
|
|
20
20
|
appId?: string;
|
|
21
21
|
loginUrl?: string;
|
|
22
|
+
env?: 'preview' | 'runtime';
|
|
23
|
+
userName?: string; // 默认中文名
|
|
24
|
+
userNameEn?: string; // 冗余一份英文名
|
|
25
|
+
userNameI18n?: Record<string, string>; // 带多语的用户名
|
|
22
26
|
},
|
|
23
27
|
csrfToken?: string;
|
|
24
28
|
}
|
|
@@ -92,4 +96,23 @@ declare class ViewContextMiddleware implements NestMiddleware {
|
|
|
92
96
|
use(req: Request, res: Response, next: NextFunction): void;
|
|
93
97
|
}
|
|
94
98
|
|
|
95
|
-
|
|
99
|
+
/**
|
|
100
|
+
* API 404 兜底 Controller
|
|
101
|
+
*
|
|
102
|
+
* 处理所有未匹配的 /api/* 路径,返回标准的 JSON 404 响应
|
|
103
|
+
*
|
|
104
|
+
* 工作原理:
|
|
105
|
+
* NestJS 会根据路由的具体程度自动排序:
|
|
106
|
+
* 1. 具体路径 (/api/users) - 最高优先级
|
|
107
|
+
* 2. 路径参数 (/api/:id)
|
|
108
|
+
* 3. 通配符 (/api/*) - 本 Controller
|
|
109
|
+
* 4. 更宽泛的通配符 (/*) - ViewModule
|
|
110
|
+
*
|
|
111
|
+
* 因此即使 PlatformModule 在其他业务模块之前导入,
|
|
112
|
+
* 具体的 API 路由仍然会优先匹配,不会被拦截。
|
|
113
|
+
*/
|
|
114
|
+
declare class ApiFallbackController {
|
|
115
|
+
handleNotFound(req: Request, res: Response): Response<any, Record<string, any>>;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export { ApiFallbackController, CsrfMiddleware, CsrfTokenMiddleware, PlatformModule, type PlatformModuleOptions, UserContextMiddleware, ViewContextMiddleware, configureApp };
|