@lark-apaas/fullstack-nestjs-core 1.1.48-alpha.15 → 1.1.48-alpha.16
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 +6 -39
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +6 -39
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -34651,6 +34651,7 @@ var ViewContextMiddleware = class _ViewContextMiddleware {
|
|
|
34651
34651
|
const { userId, tenantId, appId, loginUrl, userType } = req.userContext;
|
|
34652
34652
|
const csrfToken = req.csrfToken;
|
|
34653
34653
|
const environment = mapToWindowEnvironment(process.env.FORCE_FRAMEWORK_ENVIRONMENT);
|
|
34654
|
+
const basename = req.headers["x-miaoda-custom-host"] ? "/" : `/app/${appId || ""}`;
|
|
34654
34655
|
const appPublishedData = await this.getAppPublished(appId);
|
|
34655
34656
|
const appInfo = appPublishedData?.app_info ?? null;
|
|
34656
34657
|
req.__platform_data__ = {
|
|
@@ -34665,7 +34666,8 @@ var ViewContextMiddleware = class _ViewContextMiddleware {
|
|
|
34665
34666
|
tenantId,
|
|
34666
34667
|
environment,
|
|
34667
34668
|
showBadge: appInfo?.show_badge !== false,
|
|
34668
|
-
appPublished: appPublishedData ?? null
|
|
34669
|
+
appPublished: appPublishedData ?? null,
|
|
34670
|
+
basename
|
|
34669
34671
|
};
|
|
34670
34672
|
res.locals = {
|
|
34671
34673
|
...res.locals ?? {},
|
|
@@ -34678,7 +34680,8 @@ var ViewContextMiddleware = class _ViewContextMiddleware {
|
|
|
34678
34680
|
appName: safeEscape(appInfo?.app_name ?? "\u5999\u642D\u5E94\u7528"),
|
|
34679
34681
|
appAvatar: appInfo?.app_avatar ?? "",
|
|
34680
34682
|
appDescription: safeEscape(appInfo?.app_description ?? ""),
|
|
34681
|
-
environment
|
|
34683
|
+
environment,
|
|
34684
|
+
basename
|
|
34682
34685
|
};
|
|
34683
34686
|
next();
|
|
34684
34687
|
}
|
|
@@ -35081,9 +35084,6 @@ var PlatformHttpClientService = class _PlatformHttpClientService {
|
|
|
35081
35084
|
...baseConfig,
|
|
35082
35085
|
platform: {
|
|
35083
35086
|
enabled: true
|
|
35084
|
-
},
|
|
35085
|
-
preInterceptors: {
|
|
35086
|
-
request: this.createClaimsPreInterceptors()
|
|
35087
35087
|
}
|
|
35088
35088
|
});
|
|
35089
35089
|
this.protectedClient = new ProtectedHttpClient(this.client);
|
|
@@ -35158,10 +35158,7 @@ var PlatformHttpClientService = class _PlatformHttpClientService {
|
|
|
35158
35158
|
};
|
|
35159
35159
|
return new import_http_client.HttpClient({
|
|
35160
35160
|
...mergedConfig,
|
|
35161
|
-
platform: mergedPlatform
|
|
35162
|
-
preInterceptors: {
|
|
35163
|
-
request: this.createClaimsPreInterceptors()
|
|
35164
|
-
}
|
|
35161
|
+
platform: mergedPlatform
|
|
35165
35162
|
});
|
|
35166
35163
|
}
|
|
35167
35164
|
/**
|
|
@@ -35189,36 +35186,6 @@ var PlatformHttpClientService = class _PlatformHttpClientService {
|
|
|
35189
35186
|
this.registerInterceptorsForClient(client);
|
|
35190
35187
|
return client;
|
|
35191
35188
|
}
|
|
35192
|
-
createClaimsPreInterceptors() {
|
|
35193
|
-
return [
|
|
35194
|
-
{
|
|
35195
|
-
onFulfilled: /* @__PURE__ */ __name((config) => {
|
|
35196
|
-
const userId = this.requestContext.get("userId");
|
|
35197
|
-
const tenantId = this.requestContext.get("tenantId");
|
|
35198
|
-
const contextClaims = {};
|
|
35199
|
-
if (userId) {
|
|
35200
|
-
contextClaims.user_id = userId;
|
|
35201
|
-
}
|
|
35202
|
-
if (tenantId) {
|
|
35203
|
-
contextClaims.tenant_id = tenantId;
|
|
35204
|
-
}
|
|
35205
|
-
if (contextClaims.user_id === void 0 && contextClaims.tenant_id === void 0) {
|
|
35206
|
-
return config;
|
|
35207
|
-
}
|
|
35208
|
-
return {
|
|
35209
|
-
...config,
|
|
35210
|
-
platformAuth: {
|
|
35211
|
-
...config.platformAuth,
|
|
35212
|
-
customClaims: {
|
|
35213
|
-
...contextClaims,
|
|
35214
|
-
...config.platformAuth?.customClaims || {}
|
|
35215
|
-
}
|
|
35216
|
-
}
|
|
35217
|
-
};
|
|
35218
|
-
}, "onFulfilled")
|
|
35219
|
-
}
|
|
35220
|
-
];
|
|
35221
|
-
}
|
|
35222
35189
|
/**
|
|
35223
35190
|
* 注册全局拦截器(用于单例实例)
|
|
35224
35191
|
*/
|
package/dist/index.d.cts
CHANGED
|
@@ -23,6 +23,8 @@ declare global {
|
|
|
23
23
|
userId?: string;
|
|
24
24
|
tenantId?: number;
|
|
25
25
|
csrfToken?: string;
|
|
26
|
+
/** React Router basename,由 ViewContextMiddleware 注入;自定义域名场景下 = / 或 /<alias>,默认域名 = /app/<appId> */
|
|
27
|
+
basename?: string;
|
|
26
28
|
[key: string]: unknown;
|
|
27
29
|
};
|
|
28
30
|
userContext: {
|
|
@@ -385,7 +387,6 @@ declare class PlatformHttpClientService {
|
|
|
385
387
|
* ```
|
|
386
388
|
*/
|
|
387
389
|
createWithGlobalInterceptors(options?: PlatformHttpClientOptions): HttpClient;
|
|
388
|
-
private createClaimsPreInterceptors;
|
|
389
390
|
/**
|
|
390
391
|
* 注册全局拦截器(用于单例实例)
|
|
391
392
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -23,6 +23,8 @@ declare global {
|
|
|
23
23
|
userId?: string;
|
|
24
24
|
tenantId?: number;
|
|
25
25
|
csrfToken?: string;
|
|
26
|
+
/** React Router basename,由 ViewContextMiddleware 注入;自定义域名场景下 = / 或 /<alias>,默认域名 = /app/<appId> */
|
|
27
|
+
basename?: string;
|
|
26
28
|
[key: string]: unknown;
|
|
27
29
|
};
|
|
28
30
|
userContext: {
|
|
@@ -385,7 +387,6 @@ declare class PlatformHttpClientService {
|
|
|
385
387
|
* ```
|
|
386
388
|
*/
|
|
387
389
|
createWithGlobalInterceptors(options?: PlatformHttpClientOptions): HttpClient;
|
|
388
|
-
private createClaimsPreInterceptors;
|
|
389
390
|
/**
|
|
390
391
|
* 注册全局拦截器(用于单例实例)
|
|
391
392
|
*/
|
package/dist/index.js
CHANGED
|
@@ -34624,6 +34624,7 @@ var ViewContextMiddleware = class _ViewContextMiddleware {
|
|
|
34624
34624
|
const { userId, tenantId, appId, loginUrl, userType } = req.userContext;
|
|
34625
34625
|
const csrfToken = req.csrfToken;
|
|
34626
34626
|
const environment = mapToWindowEnvironment(process.env.FORCE_FRAMEWORK_ENVIRONMENT);
|
|
34627
|
+
const basename = req.headers["x-miaoda-custom-host"] ? "/" : `/app/${appId || ""}`;
|
|
34627
34628
|
const appPublishedData = await this.getAppPublished(appId);
|
|
34628
34629
|
const appInfo = appPublishedData?.app_info ?? null;
|
|
34629
34630
|
req.__platform_data__ = {
|
|
@@ -34638,7 +34639,8 @@ var ViewContextMiddleware = class _ViewContextMiddleware {
|
|
|
34638
34639
|
tenantId,
|
|
34639
34640
|
environment,
|
|
34640
34641
|
showBadge: appInfo?.show_badge !== false,
|
|
34641
|
-
appPublished: appPublishedData ?? null
|
|
34642
|
+
appPublished: appPublishedData ?? null,
|
|
34643
|
+
basename
|
|
34642
34644
|
};
|
|
34643
34645
|
res.locals = {
|
|
34644
34646
|
...res.locals ?? {},
|
|
@@ -34651,7 +34653,8 @@ var ViewContextMiddleware = class _ViewContextMiddleware {
|
|
|
34651
34653
|
appName: safeEscape(appInfo?.app_name ?? "\u5999\u642D\u5E94\u7528"),
|
|
34652
34654
|
appAvatar: appInfo?.app_avatar ?? "",
|
|
34653
34655
|
appDescription: safeEscape(appInfo?.app_description ?? ""),
|
|
34654
|
-
environment
|
|
34656
|
+
environment,
|
|
34657
|
+
basename
|
|
34655
34658
|
};
|
|
34656
34659
|
next();
|
|
34657
34660
|
}
|
|
@@ -35054,9 +35057,6 @@ var PlatformHttpClientService = class _PlatformHttpClientService {
|
|
|
35054
35057
|
...baseConfig,
|
|
35055
35058
|
platform: {
|
|
35056
35059
|
enabled: true
|
|
35057
|
-
},
|
|
35058
|
-
preInterceptors: {
|
|
35059
|
-
request: this.createClaimsPreInterceptors()
|
|
35060
35060
|
}
|
|
35061
35061
|
});
|
|
35062
35062
|
this.protectedClient = new ProtectedHttpClient(this.client);
|
|
@@ -35131,10 +35131,7 @@ var PlatformHttpClientService = class _PlatformHttpClientService {
|
|
|
35131
35131
|
};
|
|
35132
35132
|
return new HttpClient({
|
|
35133
35133
|
...mergedConfig,
|
|
35134
|
-
platform: mergedPlatform
|
|
35135
|
-
preInterceptors: {
|
|
35136
|
-
request: this.createClaimsPreInterceptors()
|
|
35137
|
-
}
|
|
35134
|
+
platform: mergedPlatform
|
|
35138
35135
|
});
|
|
35139
35136
|
}
|
|
35140
35137
|
/**
|
|
@@ -35162,36 +35159,6 @@ var PlatformHttpClientService = class _PlatformHttpClientService {
|
|
|
35162
35159
|
this.registerInterceptorsForClient(client);
|
|
35163
35160
|
return client;
|
|
35164
35161
|
}
|
|
35165
|
-
createClaimsPreInterceptors() {
|
|
35166
|
-
return [
|
|
35167
|
-
{
|
|
35168
|
-
onFulfilled: /* @__PURE__ */ __name((config) => {
|
|
35169
|
-
const userId = this.requestContext.get("userId");
|
|
35170
|
-
const tenantId = this.requestContext.get("tenantId");
|
|
35171
|
-
const contextClaims = {};
|
|
35172
|
-
if (userId) {
|
|
35173
|
-
contextClaims.user_id = userId;
|
|
35174
|
-
}
|
|
35175
|
-
if (tenantId) {
|
|
35176
|
-
contextClaims.tenant_id = tenantId;
|
|
35177
|
-
}
|
|
35178
|
-
if (contextClaims.user_id === void 0 && contextClaims.tenant_id === void 0) {
|
|
35179
|
-
return config;
|
|
35180
|
-
}
|
|
35181
|
-
return {
|
|
35182
|
-
...config,
|
|
35183
|
-
platformAuth: {
|
|
35184
|
-
...config.platformAuth,
|
|
35185
|
-
customClaims: {
|
|
35186
|
-
...contextClaims,
|
|
35187
|
-
...config.platformAuth?.customClaims || {}
|
|
35188
|
-
}
|
|
35189
|
-
}
|
|
35190
|
-
};
|
|
35191
|
-
}, "onFulfilled")
|
|
35192
|
-
}
|
|
35193
|
-
];
|
|
35194
|
-
}
|
|
35195
35162
|
/**
|
|
35196
35163
|
* 注册全局拦截器(用于单例实例)
|
|
35197
35164
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lark-apaas/fullstack-nestjs-core",
|
|
3
|
-
"version": "1.1.48-alpha.
|
|
3
|
+
"version": "1.1.48-alpha.16",
|
|
4
4
|
"description": "FullStack Nestjs Core",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@lark-apaas/file-service": "^0.1.2",
|
|
43
|
-
"@lark-apaas/http-client": "0.1.
|
|
43
|
+
"@lark-apaas/http-client": "^0.1.5",
|
|
44
44
|
"@lark-apaas/nestjs-authnpaas": "^1.0.3",
|
|
45
45
|
"@lark-apaas/nestjs-authzpaas": "^0.1.8",
|
|
46
46
|
"@lark-apaas/nestjs-capability": "^0.1.13",
|