@lark-apaas/fullstack-nestjs-core 1.1.2 → 1.1.3

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
@@ -92,6 +92,7 @@ var UserContextMiddleware = class {
92
92
  tenantId: webUser?.tenant_id,
93
93
  appId: webUser?.app_id ?? "",
94
94
  loginUrl: webUser?.login_url ?? "",
95
+ userType: webUser?.user_type ?? "",
95
96
  env: webUser?.env ?? "runtime",
96
97
  userName: webUser?.user_name?.zh_cn ?? "",
97
98
  userNameEn: webUser?.user_name?.en_us ?? "",
@@ -272,8 +273,18 @@ function createApiNotFoundResponse(req) {
272
273
  };
273
274
  }
274
275
  __name(createApiNotFoundResponse, "createApiNotFoundResponse");
276
+ function getApiPathPrefix() {
277
+ const globalPrefix = process.env.CLIENT_BASE_PATH ?? "";
278
+ if (!globalPrefix) {
279
+ return "/api/";
280
+ }
281
+ const normalizedPrefix = globalPrefix.replace(/\/+$/, "");
282
+ return `${normalizedPrefix}/api/`;
283
+ }
284
+ __name(getApiPathPrefix, "getApiPathPrefix");
275
285
  function apiResponseInterceptor(req, res, next) {
276
- if (!req.baseUrl.startsWith("/api/")) {
286
+ const apiPrefix = getApiPathPrefix();
287
+ if (!req.baseUrl.startsWith(apiPrefix)) {
277
288
  return next();
278
289
  }
279
290
  res.render = function() {
package/dist/index.d.cts CHANGED
@@ -19,6 +19,7 @@ declare global {
19
19
  tenantId?: number;
20
20
  appId?: string;
21
21
  loginUrl?: string;
22
+ userType?: string;
22
23
  env?: 'preview' | 'runtime';
23
24
  userName?: string; // 默认中文名
24
25
  userNameEn?: string; // 冗余一份英文名
package/dist/index.d.ts CHANGED
@@ -19,6 +19,7 @@ declare global {
19
19
  tenantId?: number;
20
20
  appId?: string;
21
21
  loginUrl?: string;
22
+ userType?: string;
22
23
  env?: 'preview' | 'runtime';
23
24
  userName?: string; // 默认中文名
24
25
  userNameEn?: string; // 冗余一份英文名
package/dist/index.js CHANGED
@@ -50,6 +50,7 @@ var UserContextMiddleware = class {
50
50
  tenantId: webUser?.tenant_id,
51
51
  appId: webUser?.app_id ?? "",
52
52
  loginUrl: webUser?.login_url ?? "",
53
+ userType: webUser?.user_type ?? "",
53
54
  env: webUser?.env ?? "runtime",
54
55
  userName: webUser?.user_name?.zh_cn ?? "",
55
56
  userNameEn: webUser?.user_name?.en_us ?? "",
@@ -230,8 +231,18 @@ function createApiNotFoundResponse(req) {
230
231
  };
231
232
  }
232
233
  __name(createApiNotFoundResponse, "createApiNotFoundResponse");
234
+ function getApiPathPrefix() {
235
+ const globalPrefix = process.env.CLIENT_BASE_PATH ?? "";
236
+ if (!globalPrefix) {
237
+ return "/api/";
238
+ }
239
+ const normalizedPrefix = globalPrefix.replace(/\/+$/, "");
240
+ return `${normalizedPrefix}/api/`;
241
+ }
242
+ __name(getApiPathPrefix, "getApiPathPrefix");
233
243
  function apiResponseInterceptor(req, res, next) {
234
- if (!req.baseUrl.startsWith("/api/")) {
244
+ const apiPrefix = getApiPathPrefix();
245
+ if (!req.baseUrl.startsWith(apiPrefix)) {
235
246
  return next();
236
247
  }
237
248
  res.render = function() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/fullstack-nestjs-core",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "FullStack Nestjs Core",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",