@lark-apaas/fullstack-nestjs-core 1.1.10-alpha.39 → 1.1.10-alpha.50
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 +13 -2
- package/dist/index.js +13 -2
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -268,6 +268,7 @@ var ViewContextMiddleware = class _ViewContextMiddleware {
|
|
|
268
268
|
const { userId, tenantId, appId, loginUrl, userType } = req.userContext;
|
|
269
269
|
const csrfToken = req.csrfToken;
|
|
270
270
|
const appInfo = await this.getAppInfo(appId);
|
|
271
|
+
const environment = mapToWindowEnvironment(process.env.FORCE_FRAMEWORK_ENVIRONMENT);
|
|
271
272
|
req.__platform_data__ = {
|
|
272
273
|
csrfToken: csrfToken ?? "",
|
|
273
274
|
userId: userId ?? "",
|
|
@@ -277,7 +278,8 @@ var ViewContextMiddleware = class _ViewContextMiddleware {
|
|
|
277
278
|
appDescription: safeEscape(appInfo?.app_description ?? ""),
|
|
278
279
|
loginUrl: loginUrl ?? "",
|
|
279
280
|
userType: userType ?? "",
|
|
280
|
-
tenantId
|
|
281
|
+
tenantId,
|
|
282
|
+
environment
|
|
281
283
|
};
|
|
282
284
|
res.locals = {
|
|
283
285
|
...res.locals ?? {},
|
|
@@ -289,7 +291,8 @@ var ViewContextMiddleware = class _ViewContextMiddleware {
|
|
|
289
291
|
appId: appId ?? "",
|
|
290
292
|
appName: safeEscape(appInfo?.app_name ?? "\u5999\u642D\u5E94\u7528"),
|
|
291
293
|
appAvatar: appInfo?.app_avatar ?? "",
|
|
292
|
-
appDescription: safeEscape(appInfo?.app_description ?? "")
|
|
294
|
+
appDescription: safeEscape(appInfo?.app_description ?? ""),
|
|
295
|
+
environment
|
|
293
296
|
};
|
|
294
297
|
next();
|
|
295
298
|
}
|
|
@@ -302,6 +305,14 @@ ViewContextMiddleware = _ts_decorate3([
|
|
|
302
305
|
typeof PlatformHttpClient === "undefined" ? Object : PlatformHttpClient
|
|
303
306
|
])
|
|
304
307
|
], ViewContextMiddleware);
|
|
308
|
+
function mapToWindowEnvironment(input) {
|
|
309
|
+
const value = (input || "").trim().toLowerCase();
|
|
310
|
+
if (value === "boe") return "staging";
|
|
311
|
+
if (value === "pre") return "gray";
|
|
312
|
+
if (value === "online") return "online";
|
|
313
|
+
return "online";
|
|
314
|
+
}
|
|
315
|
+
__name(mapToWindowEnvironment, "mapToWindowEnvironment");
|
|
305
316
|
|
|
306
317
|
// src/middlewares/csrf_token/index.ts
|
|
307
318
|
var import_common4 = require("@nestjs/common");
|
package/dist/index.js
CHANGED
|
@@ -224,6 +224,7 @@ var ViewContextMiddleware = class _ViewContextMiddleware {
|
|
|
224
224
|
const { userId, tenantId, appId, loginUrl, userType } = req.userContext;
|
|
225
225
|
const csrfToken = req.csrfToken;
|
|
226
226
|
const appInfo = await this.getAppInfo(appId);
|
|
227
|
+
const environment = mapToWindowEnvironment(process.env.FORCE_FRAMEWORK_ENVIRONMENT);
|
|
227
228
|
req.__platform_data__ = {
|
|
228
229
|
csrfToken: csrfToken ?? "",
|
|
229
230
|
userId: userId ?? "",
|
|
@@ -233,7 +234,8 @@ var ViewContextMiddleware = class _ViewContextMiddleware {
|
|
|
233
234
|
appDescription: safeEscape(appInfo?.app_description ?? ""),
|
|
234
235
|
loginUrl: loginUrl ?? "",
|
|
235
236
|
userType: userType ?? "",
|
|
236
|
-
tenantId
|
|
237
|
+
tenantId,
|
|
238
|
+
environment
|
|
237
239
|
};
|
|
238
240
|
res.locals = {
|
|
239
241
|
...res.locals ?? {},
|
|
@@ -245,7 +247,8 @@ var ViewContextMiddleware = class _ViewContextMiddleware {
|
|
|
245
247
|
appId: appId ?? "",
|
|
246
248
|
appName: safeEscape(appInfo?.app_name ?? "\u5999\u642D\u5E94\u7528"),
|
|
247
249
|
appAvatar: appInfo?.app_avatar ?? "",
|
|
248
|
-
appDescription: safeEscape(appInfo?.app_description ?? "")
|
|
250
|
+
appDescription: safeEscape(appInfo?.app_description ?? ""),
|
|
251
|
+
environment
|
|
249
252
|
};
|
|
250
253
|
next();
|
|
251
254
|
}
|
|
@@ -258,6 +261,14 @@ ViewContextMiddleware = _ts_decorate3([
|
|
|
258
261
|
typeof PlatformHttpClient === "undefined" ? Object : PlatformHttpClient
|
|
259
262
|
])
|
|
260
263
|
], ViewContextMiddleware);
|
|
264
|
+
function mapToWindowEnvironment(input) {
|
|
265
|
+
const value = (input || "").trim().toLowerCase();
|
|
266
|
+
if (value === "boe") return "staging";
|
|
267
|
+
if (value === "pre") return "gray";
|
|
268
|
+
if (value === "online") return "online";
|
|
269
|
+
return "online";
|
|
270
|
+
}
|
|
271
|
+
__name(mapToWindowEnvironment, "mapToWindowEnvironment");
|
|
261
272
|
|
|
262
273
|
// src/middlewares/csrf_token/index.ts
|
|
263
274
|
import { Injectable as Injectable4 } from "@nestjs/common";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lark-apaas/fullstack-nestjs-core",
|
|
3
|
-
"version": "1.1.10-alpha.
|
|
3
|
+
"version": "1.1.10-alpha.50",
|
|
4
4
|
"description": "FullStack Nestjs Core",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -41,10 +41,10 @@
|
|
|
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-authzpaas": "0.1.0-alpha.
|
|
44
|
+
"@lark-apaas/nestjs-authzpaas": "0.1.0-alpha.50",
|
|
45
45
|
"@lark-apaas/nestjs-capability": "^0.1.2",
|
|
46
46
|
"@lark-apaas/nestjs-common": "^0.1.2",
|
|
47
|
-
"@lark-apaas/nestjs-datapaas": "
|
|
47
|
+
"@lark-apaas/nestjs-datapaas": "1.0.9-alpha.50",
|
|
48
48
|
"@lark-apaas/nestjs-logger": "^1.0.8",
|
|
49
49
|
"@lark-apaas/nestjs-observable": "^0.0.3",
|
|
50
50
|
"@lark-apaas/nestjs-openapi-devtools": "^1.0.9",
|