@lark-apaas/fullstack-nestjs-core 1.1.34-alpha.60 → 1.1.34-alpha.61

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
@@ -34647,34 +34647,11 @@ var ViewContextMiddleware = class _ViewContextMiddleware {
34647
34647
  return null;
34648
34648
  }
34649
34649
  }
34650
- async getTenantInfo(appId) {
34651
- if (!appId) {
34652
- this.logger.warn(`appId is empty, skip get tenant info`);
34653
- return null;
34654
- }
34655
- try {
34656
- const resp = await this.client.get(`/b/${appId}/tenant_info`);
34657
- if (resp.status !== 200) {
34658
- throw new Error(`Failed to get tenant info, status: ${resp.status}`);
34659
- }
34660
- const data = await resp.json();
34661
- if (data.status_code !== "0") {
34662
- throw new Error(`Failed to get tenant info, status_code: ${data.status_code}`);
34663
- }
34664
- return data.data ?? null;
34665
- } catch (err) {
34666
- this.logger.error(err, "Failed to get tenant info");
34667
- return null;
34668
- }
34669
- }
34670
34650
  async use(req, res, next) {
34671
34651
  const { userId, tenantId, appId, loginUrl, userType } = req.userContext;
34672
34652
  const csrfToken = req.csrfToken;
34673
34653
  const environment = mapToWindowEnvironment(process.env.FORCE_FRAMEWORK_ENVIRONMENT);
34674
- const [appPublishedData, tenantInfoData] = await Promise.all([
34675
- this.getAppPublished(appId),
34676
- this.getTenantInfo(appId)
34677
- ]);
34654
+ const appPublishedData = await this.getAppPublished(appId);
34678
34655
  const appInfo = appPublishedData?.app_info ?? null;
34679
34656
  req.__platform_data__ = {
34680
34657
  csrfToken: csrfToken ?? "",
@@ -34687,10 +34664,7 @@ var ViewContextMiddleware = class _ViewContextMiddleware {
34687
34664
  userType: userType ?? "",
34688
34665
  tenantId,
34689
34666
  environment,
34690
- // 预注入字段,前端无需再发 API 请求
34691
34667
  showBadge: appInfo?.show_badge !== false,
34692
- tenantName: safeEscape(tenantInfoData?.tenant_info?.name ?? ""),
34693
- isInternetVisible: tenantInfoData?.is_internet_visible ?? false,
34694
34668
  appPublished: appPublishedData ?? null
34695
34669
  };
34696
34670
  res.locals = {
package/dist/index.d.cts CHANGED
@@ -202,7 +202,6 @@ declare class ViewContextMiddleware implements NestMiddleware {
202
202
  private readonly logger;
203
203
  constructor(client: PlatformHttpClient);
204
204
  private getAppPublished;
205
- private getTenantInfo;
206
205
  use(req: Request, res: Response, next: NextFunction): Promise<void>;
207
206
  }
208
207
 
package/dist/index.d.ts CHANGED
@@ -202,7 +202,6 @@ declare class ViewContextMiddleware implements NestMiddleware {
202
202
  private readonly logger;
203
203
  constructor(client: PlatformHttpClient);
204
204
  private getAppPublished;
205
- private getTenantInfo;
206
205
  use(req: Request, res: Response, next: NextFunction): Promise<void>;
207
206
  }
208
207
 
package/dist/index.js CHANGED
@@ -34620,34 +34620,11 @@ var ViewContextMiddleware = class _ViewContextMiddleware {
34620
34620
  return null;
34621
34621
  }
34622
34622
  }
34623
- async getTenantInfo(appId) {
34624
- if (!appId) {
34625
- this.logger.warn(`appId is empty, skip get tenant info`);
34626
- return null;
34627
- }
34628
- try {
34629
- const resp = await this.client.get(`/b/${appId}/tenant_info`);
34630
- if (resp.status !== 200) {
34631
- throw new Error(`Failed to get tenant info, status: ${resp.status}`);
34632
- }
34633
- const data = await resp.json();
34634
- if (data.status_code !== "0") {
34635
- throw new Error(`Failed to get tenant info, status_code: ${data.status_code}`);
34636
- }
34637
- return data.data ?? null;
34638
- } catch (err) {
34639
- this.logger.error(err, "Failed to get tenant info");
34640
- return null;
34641
- }
34642
- }
34643
34623
  async use(req, res, next) {
34644
34624
  const { userId, tenantId, appId, loginUrl, userType } = req.userContext;
34645
34625
  const csrfToken = req.csrfToken;
34646
34626
  const environment = mapToWindowEnvironment(process.env.FORCE_FRAMEWORK_ENVIRONMENT);
34647
- const [appPublishedData, tenantInfoData] = await Promise.all([
34648
- this.getAppPublished(appId),
34649
- this.getTenantInfo(appId)
34650
- ]);
34627
+ const appPublishedData = await this.getAppPublished(appId);
34651
34628
  const appInfo = appPublishedData?.app_info ?? null;
34652
34629
  req.__platform_data__ = {
34653
34630
  csrfToken: csrfToken ?? "",
@@ -34660,10 +34637,7 @@ var ViewContextMiddleware = class _ViewContextMiddleware {
34660
34637
  userType: userType ?? "",
34661
34638
  tenantId,
34662
34639
  environment,
34663
- // 预注入字段,前端无需再发 API 请求
34664
34640
  showBadge: appInfo?.show_badge !== false,
34665
- tenantName: safeEscape(tenantInfoData?.tenant_info?.name ?? ""),
34666
- isInternetVisible: tenantInfoData?.is_internet_visible ?? false,
34667
34641
  appPublished: appPublishedData ?? null
34668
34642
  };
34669
34643
  res.locals = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/fullstack-nestjs-core",
3
- "version": "1.1.34-alpha.60",
3
+ "version": "1.1.34-alpha.61",
4
4
  "description": "FullStack Nestjs Core",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",