@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 +12 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +12 -1
- package/package.json +1 -1
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
|
-
|
|
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
package/dist/index.d.ts
CHANGED
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
|
-
|
|
244
|
+
const apiPrefix = getApiPathPrefix();
|
|
245
|
+
if (!req.baseUrl.startsWith(apiPrefix)) {
|
|
235
246
|
return next();
|
|
236
247
|
}
|
|
237
248
|
res.render = function() {
|