@lark-apaas/fullstack-nestjs-core 1.1.43 → 1.1.45

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
@@ -20771,9 +20771,9 @@ var require_safe_buffer = __commonJS({
20771
20771
  }
20772
20772
  });
20773
20773
 
20774
- // ../../../node_modules/express/node_modules/content-disposition/index.js
20774
+ // ../../../node_modules/content-disposition/index.js
20775
20775
  var require_content_disposition = __commonJS({
20776
- "../../../node_modules/express/node_modules/content-disposition/index.js"(exports2, module2) {
20776
+ "../../../node_modules/content-disposition/index.js"(exports2, module2) {
20777
20777
  "use strict";
20778
20778
  module2.exports = contentDisposition;
20779
20779
  module2.exports.parse = parse;
@@ -34776,18 +34776,24 @@ function createApiNotFoundResponse(req) {
34776
34776
  };
34777
34777
  }
34778
34778
  __name(createApiNotFoundResponse, "createApiNotFoundResponse");
34779
- function getApiPathPrefix() {
34779
+ function getApiPathPrefixes() {
34780
34780
  const globalPrefix = process.env.CLIENT_BASE_PATH ?? "";
34781
34781
  if (!globalPrefix) {
34782
- return "/api/";
34782
+ return [
34783
+ "/api/",
34784
+ "/openapi/"
34785
+ ];
34783
34786
  }
34784
34787
  const normalizedPrefix = globalPrefix.replace(/\/+$/, "");
34785
- return `${normalizedPrefix}/api/`;
34788
+ return [
34789
+ `${normalizedPrefix}/api/`,
34790
+ `${normalizedPrefix}/openapi/`
34791
+ ];
34786
34792
  }
34787
- __name(getApiPathPrefix, "getApiPathPrefix");
34793
+ __name(getApiPathPrefixes, "getApiPathPrefixes");
34788
34794
  function apiResponseInterceptor(req, res, next) {
34789
- const apiPrefix = getApiPathPrefix();
34790
- if (!req.baseUrl.startsWith(apiPrefix)) {
34795
+ const apiPrefixes = getApiPathPrefixes();
34796
+ if (!apiPrefixes.some((prefix) => req.baseUrl.startsWith(prefix))) {
34791
34797
  return next();
34792
34798
  }
34793
34799
  res.render = function() {
@@ -36440,16 +36446,18 @@ var PlatformModule = class _PlatformModule {
36440
36446
  */
36441
36447
  configure(consumer) {
36442
36448
  const options = _PlatformModule.moduleOptions;
36443
- consumer.apply(apiResponseInterceptor).forRoutes("/api/*");
36449
+ consumer.apply(apiResponseInterceptor).forRoutes("/api/*", "/openapi/*");
36444
36450
  if (process.env.NODE_ENV === "development") {
36445
36451
  consumer.apply(FrameworkDebugMiddleware).forRoutes("/api/__framework__/debug");
36446
36452
  }
36447
36453
  consumer.apply(UserContextMiddleware, RequestContextMiddleware, import_nestjs_logger2.LoggerContextMiddleware, import_nestjs_observable.ObservableTraceMiddleware, ...DISABLE_DATAPASS ? [] : [
36448
36454
  import_nestjs_datapaas.SqlExecutionContextMiddleware
36449
36455
  ]).forRoutes("/*");
36450
- consumer.apply(CsrfTokenMiddleware, ViewContextMiddleware, HtmlHotUpdateViewMiddleware).exclude("/api/(.*)", "/static/(.*)").forRoutes("*");
36456
+ consumer.apply(CsrfTokenMiddleware, ViewContextMiddleware, HtmlHotUpdateViewMiddleware).exclude("/api/(.*)", "/openapi/(.*)", "/static/(.*)").forRoutes("*");
36451
36457
  if (options.enableCsrf !== false) {
36452
- const csrfRoutes = options.csrfRoutes || "/api/*";
36458
+ const csrfRoutes = options.csrfRoutes || [
36459
+ "/api/*"
36460
+ ];
36453
36461
  if (Array.isArray(csrfRoutes)) {
36454
36462
  csrfRoutes.forEach((route) => {
36455
36463
  consumer.apply(CsrfMiddleware).forRoutes(route);
package/dist/index.js CHANGED
@@ -20770,9 +20770,9 @@ var require_safe_buffer = __commonJS({
20770
20770
  }
20771
20771
  });
20772
20772
 
20773
- // ../../../node_modules/express/node_modules/content-disposition/index.js
20773
+ // ../../../node_modules/content-disposition/index.js
20774
20774
  var require_content_disposition = __commonJS({
20775
- "../../../node_modules/express/node_modules/content-disposition/index.js"(exports, module) {
20775
+ "../../../node_modules/content-disposition/index.js"(exports, module) {
20776
20776
  "use strict";
20777
20777
  module.exports = contentDisposition;
20778
20778
  module.exports.parse = parse;
@@ -34749,18 +34749,24 @@ function createApiNotFoundResponse(req) {
34749
34749
  };
34750
34750
  }
34751
34751
  __name(createApiNotFoundResponse, "createApiNotFoundResponse");
34752
- function getApiPathPrefix() {
34752
+ function getApiPathPrefixes() {
34753
34753
  const globalPrefix = process.env.CLIENT_BASE_PATH ?? "";
34754
34754
  if (!globalPrefix) {
34755
- return "/api/";
34755
+ return [
34756
+ "/api/",
34757
+ "/openapi/"
34758
+ ];
34756
34759
  }
34757
34760
  const normalizedPrefix = globalPrefix.replace(/\/+$/, "");
34758
- return `${normalizedPrefix}/api/`;
34761
+ return [
34762
+ `${normalizedPrefix}/api/`,
34763
+ `${normalizedPrefix}/openapi/`
34764
+ ];
34759
34765
  }
34760
- __name(getApiPathPrefix, "getApiPathPrefix");
34766
+ __name(getApiPathPrefixes, "getApiPathPrefixes");
34761
34767
  function apiResponseInterceptor(req, res, next) {
34762
- const apiPrefix = getApiPathPrefix();
34763
- if (!req.baseUrl.startsWith(apiPrefix)) {
34768
+ const apiPrefixes = getApiPathPrefixes();
34769
+ if (!apiPrefixes.some((prefix) => req.baseUrl.startsWith(prefix))) {
34764
34770
  return next();
34765
34771
  }
34766
34772
  res.render = function() {
@@ -36413,16 +36419,18 @@ var PlatformModule = class _PlatformModule {
36413
36419
  */
36414
36420
  configure(consumer) {
36415
36421
  const options = _PlatformModule.moduleOptions;
36416
- consumer.apply(apiResponseInterceptor).forRoutes("/api/*");
36422
+ consumer.apply(apiResponseInterceptor).forRoutes("/api/*", "/openapi/*");
36417
36423
  if (process.env.NODE_ENV === "development") {
36418
36424
  consumer.apply(FrameworkDebugMiddleware).forRoutes("/api/__framework__/debug");
36419
36425
  }
36420
36426
  consumer.apply(UserContextMiddleware, RequestContextMiddleware, LoggerContextMiddleware, ObservableTraceMiddleware, ...DISABLE_DATAPASS ? [] : [
36421
36427
  SqlExecutionContextMiddleware
36422
36428
  ]).forRoutes("/*");
36423
- consumer.apply(CsrfTokenMiddleware, ViewContextMiddleware, HtmlHotUpdateViewMiddleware).exclude("/api/(.*)", "/static/(.*)").forRoutes("*");
36429
+ consumer.apply(CsrfTokenMiddleware, ViewContextMiddleware, HtmlHotUpdateViewMiddleware).exclude("/api/(.*)", "/openapi/(.*)", "/static/(.*)").forRoutes("*");
36424
36430
  if (options.enableCsrf !== false) {
36425
- const csrfRoutes = options.csrfRoutes || "/api/*";
36431
+ const csrfRoutes = options.csrfRoutes || [
36432
+ "/api/*"
36433
+ ];
36426
36434
  if (Array.isArray(csrfRoutes)) {
36427
36435
  csrfRoutes.forEach((route) => {
36428
36436
  consumer.apply(CsrfMiddleware).forRoutes(route);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/fullstack-nestjs-core",
3
- "version": "1.1.43",
3
+ "version": "1.1.45",
4
4
  "description": "FullStack Nestjs Core",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -40,10 +40,10 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "@lark-apaas/file-service": "^0.1.2",
43
- "@lark-apaas/http-client": "^0.1.2",
43
+ "@lark-apaas/http-client": "^0.1.5",
44
44
  "@lark-apaas/nestjs-authnpaas": "^1.0.3",
45
45
  "@lark-apaas/nestjs-authzpaas": "^0.1.8",
46
- "@lark-apaas/nestjs-capability": "^0.1.11",
46
+ "@lark-apaas/nestjs-capability": "^0.1.12",
47
47
  "@lark-apaas/nestjs-common": "^0.1.8",
48
48
  "@lark-apaas/nestjs-datapaas": "^1.0.19",
49
49
  "@lark-apaas/nestjs-logger": "^1.0.16",