@lark-apaas/fullstack-nestjs-core 1.1.17 → 1.1.18-alpha.1

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
@@ -267,6 +267,7 @@ var ViewContextMiddleware = class _ViewContextMiddleware {
267
267
  const { userId, tenantId, appId } = req.userContext;
268
268
  const csrfToken = req.csrfToken;
269
269
  const appInfo = await this.getAppInfo(appId);
270
+ const environment = mapToWindowEnvironment(process.env.FORCE_FRAMEWORK_ENVIRONMENT);
270
271
  req.__platform_data__ = {
271
272
  csrfToken: csrfToken ?? "",
272
273
  userId: userId ?? "",
@@ -274,7 +275,8 @@ var ViewContextMiddleware = class _ViewContextMiddleware {
274
275
  appName: safeEscape(appInfo?.app_name ?? "\u5999\u642D\u5E94\u7528"),
275
276
  appAvatar: appInfo?.app_avatar ?? "",
276
277
  appDescription: safeEscape(appInfo?.app_description ?? ""),
277
- tenantId
278
+ tenantId,
279
+ environment
278
280
  };
279
281
  res.locals = {
280
282
  ...res.locals ?? {},
@@ -284,7 +286,8 @@ var ViewContextMiddleware = class _ViewContextMiddleware {
284
286
  appId: appId ?? "",
285
287
  appName: safeEscape(appInfo?.app_name ?? "\u5999\u642D\u5E94\u7528"),
286
288
  appAvatar: appInfo?.app_avatar ?? "",
287
- appDescription: safeEscape(appInfo?.app_description ?? "")
289
+ appDescription: safeEscape(appInfo?.app_description ?? ""),
290
+ environment
288
291
  };
289
292
  next();
290
293
  }
@@ -297,6 +300,14 @@ ViewContextMiddleware = _ts_decorate3([
297
300
  typeof PlatformHttpClient === "undefined" ? Object : PlatformHttpClient
298
301
  ])
299
302
  ], ViewContextMiddleware);
303
+ function mapToWindowEnvironment(input) {
304
+ const value = (input || "").trim().toLowerCase();
305
+ if (value === "boe") return "staging";
306
+ if (value === "pre") return "gray";
307
+ if (value === "online") return "online";
308
+ return "online";
309
+ }
310
+ __name(mapToWindowEnvironment, "mapToWindowEnvironment");
300
311
 
301
312
  // src/middlewares/csrf_token/index.ts
302
313
  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 } = 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 ?? "",
@@ -231,7 +232,8 @@ var ViewContextMiddleware = class _ViewContextMiddleware {
231
232
  appName: safeEscape(appInfo?.app_name ?? "\u5999\u642D\u5E94\u7528"),
232
233
  appAvatar: appInfo?.app_avatar ?? "",
233
234
  appDescription: safeEscape(appInfo?.app_description ?? ""),
234
- tenantId
235
+ tenantId,
236
+ environment
235
237
  };
236
238
  res.locals = {
237
239
  ...res.locals ?? {},
@@ -241,7 +243,8 @@ var ViewContextMiddleware = class _ViewContextMiddleware {
241
243
  appId: appId ?? "",
242
244
  appName: safeEscape(appInfo?.app_name ?? "\u5999\u642D\u5E94\u7528"),
243
245
  appAvatar: appInfo?.app_avatar ?? "",
244
- appDescription: safeEscape(appInfo?.app_description ?? "")
246
+ appDescription: safeEscape(appInfo?.app_description ?? ""),
247
+ environment
245
248
  };
246
249
  next();
247
250
  }
@@ -254,6 +257,14 @@ ViewContextMiddleware = _ts_decorate3([
254
257
  typeof PlatformHttpClient === "undefined" ? Object : PlatformHttpClient
255
258
  ])
256
259
  ], ViewContextMiddleware);
260
+ function mapToWindowEnvironment(input) {
261
+ const value = (input || "").trim().toLowerCase();
262
+ if (value === "boe") return "staging";
263
+ if (value === "pre") return "gray";
264
+ if (value === "online") return "online";
265
+ return "online";
266
+ }
267
+ __name(mapToWindowEnvironment, "mapToWindowEnvironment");
257
268
 
258
269
  // src/middlewares/csrf_token/index.ts
259
270
  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.17",
3
+ "version": "1.1.18-alpha.1",
4
4
  "description": "FullStack Nestjs Core",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",