@lark-apaas/fullstack-nestjs-core 1.0.3-alpha.0 → 1.0.3-alpha.1

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.d.cts CHANGED
@@ -31,8 +31,7 @@ interface PlatformModuleOptions {
31
31
  }
32
32
 
33
33
  declare class PlatformModule implements NestModule {
34
- private readonly options;
35
- constructor(options: PlatformModuleOptions);
34
+ private static moduleOptions;
36
35
  static forRoot(options?: PlatformModuleOptions): DynamicModule;
37
36
  /**
38
37
  * 配置中间件
package/dist/index.d.ts CHANGED
@@ -31,8 +31,7 @@ interface PlatformModuleOptions {
31
31
  }
32
32
 
33
33
  declare class PlatformModule implements NestModule {
34
- private readonly options;
35
- constructor(options: PlatformModuleOptions);
34
+ private static moduleOptions;
36
35
  static forRoot(options?: PlatformModuleOptions): DynamicModule;
37
36
  /**
38
37
  * 配置中间件
package/dist/index.js CHANGED
@@ -13627,20 +13627,14 @@ function _ts_decorate3(decorators, target, key, desc) {
13627
13627
  return c > 3 && r && Object.defineProperty(target, key, r), r;
13628
13628
  }
13629
13629
  __name(_ts_decorate3, "_ts_decorate");
13630
- function _ts_metadata(k, v) {
13631
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
13632
- }
13633
- __name(_ts_metadata, "_ts_metadata");
13634
13630
  var PLATFORM_MODULE_OPTIONS = "PLATFORM_MODULE_OPTIONS";
13635
13631
  var PlatformModule = class _PlatformModule {
13636
13632
  static {
13637
13633
  __name(this, "PlatformModule");
13638
13634
  }
13639
- options;
13640
- constructor(options) {
13641
- this.options = options;
13642
- }
13635
+ static moduleOptions = {};
13643
13636
  static forRoot(options = {}) {
13637
+ _PlatformModule.moduleOptions = options;
13644
13638
  return {
13645
13639
  module: _PlatformModule,
13646
13640
  imports: [
@@ -13695,9 +13689,10 @@ var PlatformModule = class _PlatformModule {
13695
13689
  * 配置中间件
13696
13690
  */
13697
13691
  configure(consumer) {
13692
+ const options = _PlatformModule.moduleOptions;
13698
13693
  consumer.apply(UserContextMiddleware, LoggerContextMiddleware, SqlExecutionContextMiddleware).forRoutes("/*");
13699
- if (this.options.enableCsrf !== false) {
13700
- const csrfRoutes = this.options.csrfRoutes || "/api/*";
13694
+ if (options.enableCsrf !== false) {
13695
+ const csrfRoutes = options.csrfRoutes || "/api/*";
13701
13696
  if (Array.isArray(csrfRoutes)) {
13702
13697
  csrfRoutes.forEach((route) => {
13703
13698
  consumer.apply(CsrfMiddleware).forRoutes(route);
@@ -13710,11 +13705,7 @@ var PlatformModule = class _PlatformModule {
13710
13705
  };
13711
13706
  PlatformModule = _ts_decorate3([
13712
13707
  Global(),
13713
- Module({}),
13714
- _ts_metadata("design:type", Function),
13715
- _ts_metadata("design:paramtypes", [
13716
- typeof PlatformModuleOptions === "undefined" ? Object : PlatformModuleOptions
13717
- ])
13708
+ Module({})
13718
13709
  ], PlatformModule);
13719
13710
 
13720
13711
  // src/modules/devtool/index.ts