@lark-apaas/fullstack-nestjs-core 1.1.10-alpha.0 → 1.1.10-alpha.31

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
@@ -32,6 +32,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
32
32
  // src/index.ts
33
33
  var index_exports = {};
34
34
  __export(index_exports, {
35
+ AutoTrace: () => import_nestjs_common5.AutoTrace,
36
+ CanRole: () => import_nestjs_authzpaas2.CanRole,
35
37
  CsrfMiddleware: () => CsrfMiddleware,
36
38
  CsrfTokenMiddleware: () => CsrfTokenMiddleware,
37
39
  DevToolsModule: () => import_nestjs_openapi_devtools2.DevToolsModule,
@@ -217,7 +219,7 @@ var ViewContextMiddleware = class _ViewContextMiddleware {
217
219
  }
218
220
  }
219
221
  async use(req, res, next) {
220
- const { userId, tenantId, appId } = req.userContext;
222
+ const { userId, tenantId, appId, loginUrl, userType } = req.userContext;
221
223
  const csrfToken = req.csrfToken;
222
224
  const appInfo = await this.getAppInfo(appId);
223
225
  this.logger.debug(`appInfo: ${JSON.stringify(appInfo)}`);
@@ -228,6 +230,8 @@ var ViewContextMiddleware = class _ViewContextMiddleware {
228
230
  appName: appInfo?.app_name ?? "",
229
231
  appAvatar: appInfo?.app_avatar ?? "",
230
232
  appDescription: appInfo?.app_description ?? "",
233
+ loginUrl: loginUrl ?? "",
234
+ userType: userType ?? "",
231
235
  tenantId
232
236
  };
233
237
  res.locals = {
@@ -235,6 +239,8 @@ var ViewContextMiddleware = class _ViewContextMiddleware {
235
239
  csrfToken: csrfToken ?? "",
236
240
  userId: userId ?? "",
237
241
  tenantId: tenantId ?? "",
242
+ loginUrl: loginUrl ?? "",
243
+ userType: userType ?? "",
238
244
  appId: appId ?? "",
239
245
  appName: appInfo?.app_name ?? "\u5999\u642D\u5E94\u7528",
240
246
  appAvatar: appInfo?.app_avatar ?? "",
@@ -717,6 +723,7 @@ PlatformHttpClientService = _ts_decorate8([
717
723
  ], PlatformHttpClientService);
718
724
 
719
725
  // src/modules/platform/module.ts
726
+ var import_nestjs_authzpaas = require("@lark-apaas/nestjs-authzpaas");
720
727
  function _ts_decorate9(decorators, target, key, desc) {
721
728
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
722
729
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -769,7 +776,9 @@ var PlatformModule = class _PlatformModule {
769
776
  appLogger.log?.("SQL Query " + JSON.stringify({
770
777
  query,
771
778
  params
772
- }), "Database");
779
+ }), {
780
+ source_type: "platform"
781
+ }, "Database");
773
782
  }
774
783
  };
775
784
  return {
@@ -779,7 +788,8 @@ var PlatformModule = class _PlatformModule {
779
788
  }, "useFactory")
780
789
  }),
781
790
  import_nestjs_authnpaas.AuthNPaasModule.forRoot(),
782
- import_nestjs_trigger.AutomationModule.forRoot()
791
+ import_nestjs_trigger.AutomationModule.forRoot(),
792
+ import_nestjs_authzpaas.AuthZPaasModule.forRoot()
783
793
  ],
784
794
  providers: [
785
795
  {
@@ -807,7 +817,11 @@ var PlatformModule = class _PlatformModule {
807
817
  PlatformHttpClientService
808
818
  ]
809
819
  },
810
- HttpInterceptorService
820
+ HttpInterceptorService,
821
+ {
822
+ provide: import_core2.APP_INTERCEPTOR,
823
+ useClass: import_nestjs_observable.TraceInterceptor
824
+ }
811
825
  ],
812
826
  exports: [
813
827
  import_config2.ConfigModule,
@@ -827,7 +841,7 @@ var PlatformModule = class _PlatformModule {
827
841
  if (process.env.NODE_ENV === "development") {
828
842
  consumer.apply(FrameworkDebugMiddleware).forRoutes("/api/__framework__/debug");
829
843
  }
830
- consumer.apply(UserContextMiddleware, RequestContextMiddleware, import_nestjs_logger2.LoggerContextMiddleware, import_nestjs_datapaas.SqlExecutionContextMiddleware).forRoutes("/*");
844
+ consumer.apply(UserContextMiddleware, RequestContextMiddleware, import_nestjs_logger2.LoggerContextMiddleware, import_nestjs_observable.ObservableTraceMiddleware, import_nestjs_datapaas.SqlExecutionContextMiddleware).forRoutes("/*");
831
845
  consumer.apply(CsrfTokenMiddleware, ViewContextMiddleware).exclude("/api/(.*)").forRoutes("*");
832
846
  if (options.enableCsrf !== false) {
833
847
  const csrfRoutes = options.csrfRoutes || "/api/*";
@@ -865,11 +879,11 @@ async function configureApp(app, perms = defaultPerms) {
865
879
  basePath: process.env.CLIENT_BASE_PATH,
866
880
  docsPath: "/api_docs"
867
881
  });
882
+ console.log("App Started Successfully.");
868
883
  } catch (err) {
869
884
  console.error("[OpenAPI] OpenAPI \u751F\u6210\u5931\u8D25:", err);
870
885
  }
871
886
  }
872
- console.log("App Started Successfully.");
873
887
  }
874
888
  __name(configureApp, "configureApp");
875
889
 
@@ -879,8 +893,12 @@ __reExport(index_exports, require("@lark-apaas/nestjs-authnpaas"), module.export
879
893
  __reExport(index_exports, require("@lark-apaas/nestjs-datapaas"), module.exports);
880
894
  __reExport(index_exports, require("@lark-apaas/nestjs-observable"), module.exports);
881
895
  __reExport(index_exports, require("@lark-apaas/nestjs-trigger"), module.exports);
896
+ var import_nestjs_common5 = require("@lark-apaas/nestjs-common");
897
+ var import_nestjs_authzpaas2 = require("@lark-apaas/nestjs-authzpaas");
882
898
  // Annotate the CommonJS export names for ESM import in node:
883
899
  0 && (module.exports = {
900
+ AutoTrace,
901
+ CanRole,
884
902
  CsrfMiddleware,
885
903
  CsrfTokenMiddleware,
886
904
  DevToolsModule,
package/dist/index.d.cts CHANGED
@@ -4,10 +4,12 @@ import { NestExpressApplication } from '@nestjs/platform-express';
4
4
  export { DevToolsModule, DevToolsOptions, DevToolsV2Module, DevToolsV2Options } from '@lark-apaas/nestjs-openapi-devtools';
5
5
  import { Request, Response, NextFunction } from 'express';
6
6
  import { PlatformHttpClient } from '@lark-apaas/nestjs-common';
7
+ export { AutoTrace } from '@lark-apaas/nestjs-common';
7
8
  export * from '@lark-apaas/nestjs-authnpaas';
8
9
  export * from '@lark-apaas/nestjs-datapaas';
9
10
  export * from '@lark-apaas/nestjs-observable';
10
11
  export * from '@lark-apaas/nestjs-trigger';
12
+ export { CanRole } from '@lark-apaas/nestjs-authzpaas';
11
13
 
12
14
  declare global {
13
15
  namespace Express {
package/dist/index.d.ts CHANGED
@@ -4,10 +4,12 @@ import { NestExpressApplication } from '@nestjs/platform-express';
4
4
  export { DevToolsModule, DevToolsOptions, DevToolsV2Module, DevToolsV2Options } from '@lark-apaas/nestjs-openapi-devtools';
5
5
  import { Request, Response, NextFunction } from 'express';
6
6
  import { PlatformHttpClient } from '@lark-apaas/nestjs-common';
7
+ export { AutoTrace } from '@lark-apaas/nestjs-common';
7
8
  export * from '@lark-apaas/nestjs-authnpaas';
8
9
  export * from '@lark-apaas/nestjs-datapaas';
9
10
  export * from '@lark-apaas/nestjs-observable';
10
11
  export * from '@lark-apaas/nestjs-trigger';
12
+ export { CanRole } from '@lark-apaas/nestjs-authzpaas';
11
13
 
12
14
  declare global {
13
15
  namespace Express {
package/dist/index.js CHANGED
@@ -3,10 +3,10 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
3
3
 
4
4
  // src/modules/platform/module.ts
5
5
  import { Global, Module, ValidationPipe } from "@nestjs/common";
6
- import { APP_PIPE } from "@nestjs/core";
6
+ import { APP_INTERCEPTOR, APP_PIPE } from "@nestjs/core";
7
7
  import { CommonModule, OBSERVABLE_SERVICE } from "@lark-apaas/nestjs-common";
8
8
  import { ConfigModule, ConfigService } from "@nestjs/config";
9
- import { NestjsObservableModule as ObservableModule, Observable } from "@lark-apaas/nestjs-observable";
9
+ import { NestjsObservableModule as ObservableModule, Observable, ObservableTraceMiddleware, TraceInterceptor } from "@lark-apaas/nestjs-observable";
10
10
  import { HttpModule } from "@nestjs/axios";
11
11
  import { LoggerModule, AppLogger as AppLogger2, LoggerContextMiddleware } from "@lark-apaas/nestjs-logger";
12
12
  import { DataPaasModule, SqlExecutionContextMiddleware } from "@lark-apaas/nestjs-datapaas";
@@ -175,7 +175,7 @@ var ViewContextMiddleware = class _ViewContextMiddleware {
175
175
  }
176
176
  }
177
177
  async use(req, res, next) {
178
- const { userId, tenantId, appId } = req.userContext;
178
+ const { userId, tenantId, appId, loginUrl, userType } = req.userContext;
179
179
  const csrfToken = req.csrfToken;
180
180
  const appInfo = await this.getAppInfo(appId);
181
181
  this.logger.debug(`appInfo: ${JSON.stringify(appInfo)}`);
@@ -186,6 +186,8 @@ var ViewContextMiddleware = class _ViewContextMiddleware {
186
186
  appName: appInfo?.app_name ?? "",
187
187
  appAvatar: appInfo?.app_avatar ?? "",
188
188
  appDescription: appInfo?.app_description ?? "",
189
+ loginUrl: loginUrl ?? "",
190
+ userType: userType ?? "",
189
191
  tenantId
190
192
  };
191
193
  res.locals = {
@@ -193,6 +195,8 @@ var ViewContextMiddleware = class _ViewContextMiddleware {
193
195
  csrfToken: csrfToken ?? "",
194
196
  userId: userId ?? "",
195
197
  tenantId: tenantId ?? "",
198
+ loginUrl: loginUrl ?? "",
199
+ userType: userType ?? "",
196
200
  appId: appId ?? "",
197
201
  appName: appInfo?.app_name ?? "\u5999\u642D\u5E94\u7528",
198
202
  appAvatar: appInfo?.app_avatar ?? "",
@@ -675,6 +679,7 @@ PlatformHttpClientService = _ts_decorate8([
675
679
  ], PlatformHttpClientService);
676
680
 
677
681
  // src/modules/platform/module.ts
682
+ import { AuthZPaasModule } from "@lark-apaas/nestjs-authzpaas";
678
683
  function _ts_decorate9(decorators, target, key, desc) {
679
684
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
680
685
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -727,7 +732,9 @@ var PlatformModule = class _PlatformModule {
727
732
  appLogger.log?.("SQL Query " + JSON.stringify({
728
733
  query,
729
734
  params
730
- }), "Database");
735
+ }), {
736
+ source_type: "platform"
737
+ }, "Database");
731
738
  }
732
739
  };
733
740
  return {
@@ -737,7 +744,8 @@ var PlatformModule = class _PlatformModule {
737
744
  }, "useFactory")
738
745
  }),
739
746
  AuthNPaasModule.forRoot(),
740
- AutomationModule.forRoot()
747
+ AutomationModule.forRoot(),
748
+ AuthZPaasModule.forRoot()
741
749
  ],
742
750
  providers: [
743
751
  {
@@ -765,7 +773,11 @@ var PlatformModule = class _PlatformModule {
765
773
  PlatformHttpClientService
766
774
  ]
767
775
  },
768
- HttpInterceptorService
776
+ HttpInterceptorService,
777
+ {
778
+ provide: APP_INTERCEPTOR,
779
+ useClass: TraceInterceptor
780
+ }
769
781
  ],
770
782
  exports: [
771
783
  ConfigModule,
@@ -785,7 +797,7 @@ var PlatformModule = class _PlatformModule {
785
797
  if (process.env.NODE_ENV === "development") {
786
798
  consumer.apply(FrameworkDebugMiddleware).forRoutes("/api/__framework__/debug");
787
799
  }
788
- consumer.apply(UserContextMiddleware, RequestContextMiddleware, LoggerContextMiddleware, SqlExecutionContextMiddleware).forRoutes("/*");
800
+ consumer.apply(UserContextMiddleware, RequestContextMiddleware, LoggerContextMiddleware, ObservableTraceMiddleware, SqlExecutionContextMiddleware).forRoutes("/*");
789
801
  consumer.apply(CsrfTokenMiddleware, ViewContextMiddleware).exclude("/api/(.*)").forRoutes("*");
790
802
  if (options.enableCsrf !== false) {
791
803
  const csrfRoutes = options.csrfRoutes || "/api/*";
@@ -823,11 +835,11 @@ async function configureApp(app, perms = defaultPerms) {
823
835
  basePath: process.env.CLIENT_BASE_PATH,
824
836
  docsPath: "/api_docs"
825
837
  });
838
+ console.log("App Started Successfully.");
826
839
  } catch (err) {
827
840
  console.error("[OpenAPI] OpenAPI \u751F\u6210\u5931\u8D25:", err);
828
841
  }
829
842
  }
830
- console.log("App Started Successfully.");
831
843
  }
832
844
  __name(configureApp, "configureApp");
833
845
 
@@ -837,7 +849,11 @@ export * from "@lark-apaas/nestjs-authnpaas";
837
849
  export * from "@lark-apaas/nestjs-datapaas";
838
850
  export * from "@lark-apaas/nestjs-observable";
839
851
  export * from "@lark-apaas/nestjs-trigger";
852
+ import { AutoTrace } from "@lark-apaas/nestjs-common";
853
+ import { CanRole } from "@lark-apaas/nestjs-authzpaas";
840
854
  export {
855
+ AutoTrace,
856
+ CanRole,
841
857
  CsrfMiddleware,
842
858
  CsrfTokenMiddleware,
843
859
  DevToolsModule,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/fullstack-nestjs-core",
3
- "version": "1.1.10-alpha.0",
3
+ "version": "1.1.10-alpha.31",
4
4
  "description": "FullStack Nestjs Core",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -41,10 +41,11 @@
41
41
  "dependencies": {
42
42
  "@lark-apaas/http-client": "0.1.2",
43
43
  "@lark-apaas/nestjs-authnpaas": "^1.0.2",
44
- "@lark-apaas/nestjs-common": "^0.1.0",
45
- "@lark-apaas/nestjs-datapaas": "^1.0.6",
46
- "@lark-apaas/nestjs-logger": "^1.0.4",
47
- "@lark-apaas/nestjs-observable": "^0.0.1",
44
+ "@lark-apaas/nestjs-authzpaas": "0.1.0-alpha.31",
45
+ "@lark-apaas/nestjs-common": "0.1.0-alpha.1",
46
+ "@lark-apaas/nestjs-datapaas": "^1.0.6-alpha.5",
47
+ "@lark-apaas/nestjs-logger": "1.0.2-alpha.33",
48
+ "@lark-apaas/nestjs-observable": "0.0.1-alpha.35",
48
49
  "@lark-apaas/nestjs-openapi-devtools": "^1.0.9",
49
50
  "@lark-apaas/nestjs-trigger": "^0.0.1",
50
51
  "@nestjs/axios": "^4.0.1",