@lark-apaas/fullstack-nestjs-core 1.1.38 → 1.1.40
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 -10
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +13 -10
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -5492,9 +5492,9 @@ var require_read = __commonJS({
|
|
|
5492
5492
|
}
|
|
5493
5493
|
});
|
|
5494
5494
|
|
|
5495
|
-
// ../../../node_modules/media-typer/index.js
|
|
5495
|
+
// ../../../node_modules/type-is/node_modules/media-typer/index.js
|
|
5496
5496
|
var require_media_typer = __commonJS({
|
|
5497
|
-
"../../../node_modules/media-typer/index.js"(exports2) {
|
|
5497
|
+
"../../../node_modules/type-is/node_modules/media-typer/index.js"(exports2) {
|
|
5498
5498
|
"use strict";
|
|
5499
5499
|
var paramRegExp = /; *([!#$%&'\*\+\-\.0-9A-Z\^_`a-z\|~]+) *= *("(?:[ !\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u0020-\u007e])*"|[!#$%&'\*\+\-\.0-9A-Z\^_`a-z\|~]+) */g;
|
|
5500
5500
|
var textRegExp = /^[\u0020-\u007e\u0080-\u00ff]+$/;
|
|
@@ -34627,31 +34627,32 @@ var ViewContextMiddleware = class _ViewContextMiddleware {
|
|
|
34627
34627
|
constructor(client) {
|
|
34628
34628
|
this.client = client;
|
|
34629
34629
|
}
|
|
34630
|
-
async
|
|
34630
|
+
async getAppPublished(appId) {
|
|
34631
34631
|
if (!appId) {
|
|
34632
|
-
this.logger.warn(`appId is empty, skip get app
|
|
34632
|
+
this.logger.warn(`appId is empty, skip get app published`);
|
|
34633
34633
|
return null;
|
|
34634
34634
|
}
|
|
34635
34635
|
try {
|
|
34636
34636
|
const resp = await this.client.get(`/b/${appId}/get_published_v2`);
|
|
34637
34637
|
if (resp.status !== 200) {
|
|
34638
|
-
throw new Error(`Failed to get app
|
|
34638
|
+
throw new Error(`Failed to get app published, status: ${resp.status}`);
|
|
34639
34639
|
}
|
|
34640
34640
|
const data = await resp.json();
|
|
34641
34641
|
if (data.status_code !== "0") {
|
|
34642
|
-
throw new Error(`Failed to get app
|
|
34642
|
+
throw new Error(`Failed to get app published, status_code: ${data.status_code}`);
|
|
34643
34643
|
}
|
|
34644
|
-
return data.data
|
|
34644
|
+
return data.data ?? null;
|
|
34645
34645
|
} catch (err) {
|
|
34646
|
-
this.logger.error(err, "Failed to get app
|
|
34646
|
+
this.logger.error(err, "Failed to get app published");
|
|
34647
34647
|
return null;
|
|
34648
34648
|
}
|
|
34649
34649
|
}
|
|
34650
34650
|
async use(req, res, next) {
|
|
34651
34651
|
const { userId, tenantId, appId, loginUrl, userType } = req.userContext;
|
|
34652
34652
|
const csrfToken = req.csrfToken;
|
|
34653
|
-
const appInfo = await this.getAppInfo(appId);
|
|
34654
34653
|
const environment = mapToWindowEnvironment(process.env.FORCE_FRAMEWORK_ENVIRONMENT);
|
|
34654
|
+
const appPublishedData = await this.getAppPublished(appId);
|
|
34655
|
+
const appInfo = appPublishedData?.app_info ?? null;
|
|
34655
34656
|
req.__platform_data__ = {
|
|
34656
34657
|
csrfToken: csrfToken ?? "",
|
|
34657
34658
|
userId: userId ?? "",
|
|
@@ -34662,7 +34663,9 @@ var ViewContextMiddleware = class _ViewContextMiddleware {
|
|
|
34662
34663
|
loginUrl: loginUrl ?? "",
|
|
34663
34664
|
userType: userType ?? "",
|
|
34664
34665
|
tenantId,
|
|
34665
|
-
environment
|
|
34666
|
+
environment,
|
|
34667
|
+
showBadge: appInfo?.show_badge !== false,
|
|
34668
|
+
appPublished: appPublishedData ?? null
|
|
34666
34669
|
};
|
|
34667
34670
|
res.locals = {
|
|
34668
34671
|
...res.locals ?? {},
|
package/dist/index.d.cts
CHANGED
|
@@ -201,7 +201,7 @@ declare class ViewContextMiddleware implements NestMiddleware {
|
|
|
201
201
|
private readonly client;
|
|
202
202
|
private readonly logger;
|
|
203
203
|
constructor(client: PlatformHttpClient);
|
|
204
|
-
private
|
|
204
|
+
private getAppPublished;
|
|
205
205
|
use(req: Request, res: Response, next: NextFunction): Promise<void>;
|
|
206
206
|
}
|
|
207
207
|
|
package/dist/index.d.ts
CHANGED
|
@@ -201,7 +201,7 @@ declare class ViewContextMiddleware implements NestMiddleware {
|
|
|
201
201
|
private readonly client;
|
|
202
202
|
private readonly logger;
|
|
203
203
|
constructor(client: PlatformHttpClient);
|
|
204
|
-
private
|
|
204
|
+
private getAppPublished;
|
|
205
205
|
use(req: Request, res: Response, next: NextFunction): Promise<void>;
|
|
206
206
|
}
|
|
207
207
|
|
package/dist/index.js
CHANGED
|
@@ -5491,9 +5491,9 @@ var require_read = __commonJS({
|
|
|
5491
5491
|
}
|
|
5492
5492
|
});
|
|
5493
5493
|
|
|
5494
|
-
// ../../../node_modules/media-typer/index.js
|
|
5494
|
+
// ../../../node_modules/type-is/node_modules/media-typer/index.js
|
|
5495
5495
|
var require_media_typer = __commonJS({
|
|
5496
|
-
"../../../node_modules/media-typer/index.js"(exports) {
|
|
5496
|
+
"../../../node_modules/type-is/node_modules/media-typer/index.js"(exports) {
|
|
5497
5497
|
"use strict";
|
|
5498
5498
|
var paramRegExp = /; *([!#$%&'\*\+\-\.0-9A-Z\^_`a-z\|~]+) *= *("(?:[ !\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u0020-\u007e])*"|[!#$%&'\*\+\-\.0-9A-Z\^_`a-z\|~]+) */g;
|
|
5499
5499
|
var textRegExp = /^[\u0020-\u007e\u0080-\u00ff]+$/;
|
|
@@ -34600,31 +34600,32 @@ var ViewContextMiddleware = class _ViewContextMiddleware {
|
|
|
34600
34600
|
constructor(client) {
|
|
34601
34601
|
this.client = client;
|
|
34602
34602
|
}
|
|
34603
|
-
async
|
|
34603
|
+
async getAppPublished(appId) {
|
|
34604
34604
|
if (!appId) {
|
|
34605
|
-
this.logger.warn(`appId is empty, skip get app
|
|
34605
|
+
this.logger.warn(`appId is empty, skip get app published`);
|
|
34606
34606
|
return null;
|
|
34607
34607
|
}
|
|
34608
34608
|
try {
|
|
34609
34609
|
const resp = await this.client.get(`/b/${appId}/get_published_v2`);
|
|
34610
34610
|
if (resp.status !== 200) {
|
|
34611
|
-
throw new Error(`Failed to get app
|
|
34611
|
+
throw new Error(`Failed to get app published, status: ${resp.status}`);
|
|
34612
34612
|
}
|
|
34613
34613
|
const data = await resp.json();
|
|
34614
34614
|
if (data.status_code !== "0") {
|
|
34615
|
-
throw new Error(`Failed to get app
|
|
34615
|
+
throw new Error(`Failed to get app published, status_code: ${data.status_code}`);
|
|
34616
34616
|
}
|
|
34617
|
-
return data.data
|
|
34617
|
+
return data.data ?? null;
|
|
34618
34618
|
} catch (err) {
|
|
34619
|
-
this.logger.error(err, "Failed to get app
|
|
34619
|
+
this.logger.error(err, "Failed to get app published");
|
|
34620
34620
|
return null;
|
|
34621
34621
|
}
|
|
34622
34622
|
}
|
|
34623
34623
|
async use(req, res, next) {
|
|
34624
34624
|
const { userId, tenantId, appId, loginUrl, userType } = req.userContext;
|
|
34625
34625
|
const csrfToken = req.csrfToken;
|
|
34626
|
-
const appInfo = await this.getAppInfo(appId);
|
|
34627
34626
|
const environment = mapToWindowEnvironment(process.env.FORCE_FRAMEWORK_ENVIRONMENT);
|
|
34627
|
+
const appPublishedData = await this.getAppPublished(appId);
|
|
34628
|
+
const appInfo = appPublishedData?.app_info ?? null;
|
|
34628
34629
|
req.__platform_data__ = {
|
|
34629
34630
|
csrfToken: csrfToken ?? "",
|
|
34630
34631
|
userId: userId ?? "",
|
|
@@ -34635,7 +34636,9 @@ var ViewContextMiddleware = class _ViewContextMiddleware {
|
|
|
34635
34636
|
loginUrl: loginUrl ?? "",
|
|
34636
34637
|
userType: userType ?? "",
|
|
34637
34638
|
tenantId,
|
|
34638
|
-
environment
|
|
34639
|
+
environment,
|
|
34640
|
+
showBadge: appInfo?.show_badge !== false,
|
|
34641
|
+
appPublished: appPublishedData ?? null
|
|
34639
34642
|
};
|
|
34640
34643
|
res.locals = {
|
|
34641
34644
|
...res.locals ?? {},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lark-apaas/fullstack-nestjs-core",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.40",
|
|
4
4
|
"description": "FullStack Nestjs Core",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@lark-apaas/nestjs-authzpaas": "^0.1.8",
|
|
46
46
|
"@lark-apaas/nestjs-capability": "^0.1.11",
|
|
47
47
|
"@lark-apaas/nestjs-common": "^0.1.8",
|
|
48
|
-
"@lark-apaas/nestjs-datapaas": "^1.0.
|
|
48
|
+
"@lark-apaas/nestjs-datapaas": "^1.0.19",
|
|
49
49
|
"@lark-apaas/nestjs-logger": "^1.0.16",
|
|
50
50
|
"@lark-apaas/nestjs-observable": "^0.0.11",
|
|
51
51
|
"@lark-apaas/nestjs-openapi-devtools": "^1.0.10",
|