@lark-apaas/fullstack-nestjs-core 1.0.3-alpha.4 → 1.0.3-alpha.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.
package/dist/index.cjs CHANGED
@@ -13505,6 +13505,7 @@ __export(index_exports, {
13505
13505
  DevToolsModule: () => DevToolsModule,
13506
13506
  PlatformModule: () => PlatformModule,
13507
13507
  UserContextMiddleware: () => UserContextMiddleware,
13508
+ ViewContextMiddleware: () => ViewContextMiddleware,
13508
13509
  configureApp: () => configureApp
13509
13510
  });
13510
13511
  module.exports = __toCommonJS(index_exports);
@@ -13638,11 +13639,11 @@ var ViewContextMiddleware = class {
13638
13639
  const { userId, tenantId, appId } = req.userContext;
13639
13640
  const csrfToken = req.csrfToken;
13640
13641
  res.locals = {
13642
+ ...res.locals,
13641
13643
  csrfToken: csrfToken ?? "",
13642
13644
  userId: userId ?? "",
13643
13645
  tenantId: tenantId ?? "",
13644
- appId: appId ?? "",
13645
- ...res.locals
13646
+ appId: appId ?? ""
13646
13647
  };
13647
13648
  next();
13648
13649
  }
@@ -13810,7 +13811,7 @@ var PlatformModule = class _PlatformModule {
13810
13811
  configure(consumer) {
13811
13812
  const options = _PlatformModule.moduleOptions;
13812
13813
  consumer.apply(UserContextMiddleware, import_nestjs_logger.LoggerContextMiddleware, import_nestjs_datapaas.SqlExecutionContextMiddleware).forRoutes("/*");
13813
- consumer.apply(CsrfTokenMiddleware, ViewContextMiddleware).exclude("/api/*");
13814
+ consumer.apply(CsrfTokenMiddleware, ViewContextMiddleware).exclude("/api/(.*)").forRoutes("*");
13814
13815
  if (options.enableCsrf !== false) {
13815
13816
  const csrfRoutes = options.csrfRoutes || "/api/*";
13816
13817
  if (Array.isArray(csrfRoutes)) {
@@ -13943,5 +13944,6 @@ __name(configureApp, "configureApp");
13943
13944
  DevToolsModule,
13944
13945
  PlatformModule,
13945
13946
  UserContextMiddleware,
13947
+ ViewContextMiddleware,
13946
13948
  configureApp
13947
13949
  });
package/dist/index.d.cts CHANGED
@@ -95,4 +95,8 @@ declare class UserContextMiddleware implements NestMiddleware {
95
95
  use(req: Request, _res: Response, next: NextFunction): void;
96
96
  }
97
97
 
98
- export { CsrfMiddleware, CsrfTokenMiddleware, DevToolsModule, PlatformModule, type PlatformModuleOptions, UserContextMiddleware, configureApp };
98
+ declare class ViewContextMiddleware implements NestMiddleware {
99
+ use(req: Request, res: Response, next: NextFunction): void;
100
+ }
101
+
102
+ export { CsrfMiddleware, CsrfTokenMiddleware, DevToolsModule, PlatformModule, type PlatformModuleOptions, UserContextMiddleware, ViewContextMiddleware, configureApp };
package/dist/index.d.ts CHANGED
@@ -95,4 +95,8 @@ declare class UserContextMiddleware implements NestMiddleware {
95
95
  use(req: Request, _res: Response, next: NextFunction): void;
96
96
  }
97
97
 
98
- export { CsrfMiddleware, CsrfTokenMiddleware, DevToolsModule, PlatformModule, type PlatformModuleOptions, UserContextMiddleware, configureApp };
98
+ declare class ViewContextMiddleware implements NestMiddleware {
99
+ use(req: Request, res: Response, next: NextFunction): void;
100
+ }
101
+
102
+ export { CsrfMiddleware, CsrfTokenMiddleware, DevToolsModule, PlatformModule, type PlatformModuleOptions, UserContextMiddleware, ViewContextMiddleware, configureApp };
package/dist/index.js CHANGED
@@ -13626,11 +13626,11 @@ var ViewContextMiddleware = class {
13626
13626
  const { userId, tenantId, appId } = req.userContext;
13627
13627
  const csrfToken = req.csrfToken;
13628
13628
  res.locals = {
13629
+ ...res.locals,
13629
13630
  csrfToken: csrfToken ?? "",
13630
13631
  userId: userId ?? "",
13631
13632
  tenantId: tenantId ?? "",
13632
- appId: appId ?? "",
13633
- ...res.locals
13633
+ appId: appId ?? ""
13634
13634
  };
13635
13635
  next();
13636
13636
  }
@@ -13798,7 +13798,7 @@ var PlatformModule = class _PlatformModule {
13798
13798
  configure(consumer) {
13799
13799
  const options = _PlatformModule.moduleOptions;
13800
13800
  consumer.apply(UserContextMiddleware, LoggerContextMiddleware, SqlExecutionContextMiddleware).forRoutes("/*");
13801
- consumer.apply(CsrfTokenMiddleware, ViewContextMiddleware).exclude("/api/*");
13801
+ consumer.apply(CsrfTokenMiddleware, ViewContextMiddleware).exclude("/api/(.*)").forRoutes("*");
13802
13802
  if (options.enableCsrf !== false) {
13803
13803
  const csrfRoutes = options.csrfRoutes || "/api/*";
13804
13804
  if (Array.isArray(csrfRoutes)) {
@@ -13930,5 +13930,6 @@ export {
13930
13930
  DevToolsModule,
13931
13931
  PlatformModule,
13932
13932
  UserContextMiddleware,
13933
+ ViewContextMiddleware,
13933
13934
  configureApp
13934
13935
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/fullstack-nestjs-core",
3
- "version": "1.0.3-alpha.4",
3
+ "version": "1.0.3-alpha.5",
4
4
  "description": "FullStack Nestjs Core",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -54,6 +54,8 @@
54
54
  "@types/cookie-parser": "^1.4.9",
55
55
  "@types/express": "^5.0.3",
56
56
  "@types/hbs": "^4.0.5",
57
+ "class-transformer": "^0.5.1",
58
+ "class-validator": "^0.14.2",
57
59
  "drizzle-orm": "0.44.6",
58
60
  "tsup": "^8.0.0",
59
61
  "typescript": "^5.0.0"
@@ -62,6 +64,8 @@
62
64
  "@nestjs/common": "^10.4.20",
63
65
  "@nestjs/platform-express": "^10.4.20",
64
66
  "@nestjs/swagger": "^7.4.2",
67
+ "class-transformer": "^0.5.1",
68
+ "class-validator": "^0.14.2",
65
69
  "drizzle-orm": "0.44.6"
66
70
  }
67
71
  }