@lark-apaas/fullstack-nestjs-core 1.1.48-alpha.10 → 1.1.48-alpha.11
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 +37 -22
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +37 -22
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -35082,6 +35082,9 @@ var PlatformHttpClientService = class _PlatformHttpClientService {
|
|
|
35082
35082
|
...baseConfig,
|
|
35083
35083
|
platform: {
|
|
35084
35084
|
enabled: true
|
|
35085
|
+
},
|
|
35086
|
+
preInterceptors: {
|
|
35087
|
+
request: this.createClaimsPreInterceptors()
|
|
35085
35088
|
}
|
|
35086
35089
|
});
|
|
35087
35090
|
this.protectedClient = new ProtectedHttpClient(this.client);
|
|
@@ -35156,7 +35159,10 @@ var PlatformHttpClientService = class _PlatformHttpClientService {
|
|
|
35156
35159
|
};
|
|
35157
35160
|
return new import_http_client.HttpClient({
|
|
35158
35161
|
...mergedConfig,
|
|
35159
|
-
platform: mergedPlatform
|
|
35162
|
+
platform: mergedPlatform,
|
|
35163
|
+
preInterceptors: {
|
|
35164
|
+
request: this.createClaimsPreInterceptors()
|
|
35165
|
+
}
|
|
35160
35166
|
});
|
|
35161
35167
|
}
|
|
35162
35168
|
/**
|
|
@@ -35184,6 +35190,36 @@ var PlatformHttpClientService = class _PlatformHttpClientService {
|
|
|
35184
35190
|
this.registerInterceptorsForClient(client);
|
|
35185
35191
|
return client;
|
|
35186
35192
|
}
|
|
35193
|
+
createClaimsPreInterceptors() {
|
|
35194
|
+
return [
|
|
35195
|
+
{
|
|
35196
|
+
onFulfilled: /* @__PURE__ */ __name((config) => {
|
|
35197
|
+
const userId = this.requestContext.get("userId");
|
|
35198
|
+
const tenantId = this.requestContext.get("tenantId");
|
|
35199
|
+
const contextClaims = {};
|
|
35200
|
+
if (userId) {
|
|
35201
|
+
contextClaims.user_id = userId;
|
|
35202
|
+
}
|
|
35203
|
+
if (tenantId) {
|
|
35204
|
+
contextClaims.tenant_id = tenantId;
|
|
35205
|
+
}
|
|
35206
|
+
if (contextClaims.user_id === void 0 && contextClaims.tenant_id === void 0) {
|
|
35207
|
+
return config;
|
|
35208
|
+
}
|
|
35209
|
+
return {
|
|
35210
|
+
...config,
|
|
35211
|
+
platformAuth: {
|
|
35212
|
+
...config.platformAuth,
|
|
35213
|
+
customClaims: {
|
|
35214
|
+
...contextClaims,
|
|
35215
|
+
...config.platformAuth?.customClaims || {}
|
|
35216
|
+
}
|
|
35217
|
+
}
|
|
35218
|
+
};
|
|
35219
|
+
}, "onFulfilled")
|
|
35220
|
+
}
|
|
35221
|
+
];
|
|
35222
|
+
}
|
|
35187
35223
|
/**
|
|
35188
35224
|
* 注册全局拦截器(用于单例实例)
|
|
35189
35225
|
*/
|
|
@@ -35209,27 +35245,6 @@ var PlatformHttpClientService = class _PlatformHttpClientService {
|
|
|
35209
35245
|
"x-tt-env": ttEnv
|
|
35210
35246
|
};
|
|
35211
35247
|
}
|
|
35212
|
-
const userId = this.requestContext.get("userId");
|
|
35213
|
-
const tenantIdRaw = this.requestContext.get("tenantId");
|
|
35214
|
-
const contextClaims = {};
|
|
35215
|
-
if (userId) {
|
|
35216
|
-
contextClaims.user_id = userId;
|
|
35217
|
-
}
|
|
35218
|
-
if (tenantIdRaw !== void 0 && tenantIdRaw !== "") {
|
|
35219
|
-
const tenantIdNum = typeof tenantIdRaw === "number" ? tenantIdRaw : Number(tenantIdRaw);
|
|
35220
|
-
if (Number.isFinite(tenantIdNum)) {
|
|
35221
|
-
contextClaims.tenant_id = tenantIdNum;
|
|
35222
|
-
}
|
|
35223
|
-
}
|
|
35224
|
-
if (contextClaims.user_id !== void 0 || contextClaims.tenant_id !== void 0) {
|
|
35225
|
-
config.platformAuth = {
|
|
35226
|
-
...config.platformAuth,
|
|
35227
|
-
customClaims: {
|
|
35228
|
-
...contextClaims,
|
|
35229
|
-
...config.platformAuth?.customClaims || {}
|
|
35230
|
-
}
|
|
35231
|
-
};
|
|
35232
|
-
}
|
|
35233
35248
|
return config;
|
|
35234
35249
|
}, (error) => {
|
|
35235
35250
|
this.logger.error("Server SDK HTTP Request Error", error, "HttpService");
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -35055,6 +35055,9 @@ var PlatformHttpClientService = class _PlatformHttpClientService {
|
|
|
35055
35055
|
...baseConfig,
|
|
35056
35056
|
platform: {
|
|
35057
35057
|
enabled: true
|
|
35058
|
+
},
|
|
35059
|
+
preInterceptors: {
|
|
35060
|
+
request: this.createClaimsPreInterceptors()
|
|
35058
35061
|
}
|
|
35059
35062
|
});
|
|
35060
35063
|
this.protectedClient = new ProtectedHttpClient(this.client);
|
|
@@ -35129,7 +35132,10 @@ var PlatformHttpClientService = class _PlatformHttpClientService {
|
|
|
35129
35132
|
};
|
|
35130
35133
|
return new HttpClient({
|
|
35131
35134
|
...mergedConfig,
|
|
35132
|
-
platform: mergedPlatform
|
|
35135
|
+
platform: mergedPlatform,
|
|
35136
|
+
preInterceptors: {
|
|
35137
|
+
request: this.createClaimsPreInterceptors()
|
|
35138
|
+
}
|
|
35133
35139
|
});
|
|
35134
35140
|
}
|
|
35135
35141
|
/**
|
|
@@ -35157,6 +35163,36 @@ var PlatformHttpClientService = class _PlatformHttpClientService {
|
|
|
35157
35163
|
this.registerInterceptorsForClient(client);
|
|
35158
35164
|
return client;
|
|
35159
35165
|
}
|
|
35166
|
+
createClaimsPreInterceptors() {
|
|
35167
|
+
return [
|
|
35168
|
+
{
|
|
35169
|
+
onFulfilled: /* @__PURE__ */ __name((config) => {
|
|
35170
|
+
const userId = this.requestContext.get("userId");
|
|
35171
|
+
const tenantId = this.requestContext.get("tenantId");
|
|
35172
|
+
const contextClaims = {};
|
|
35173
|
+
if (userId) {
|
|
35174
|
+
contextClaims.user_id = userId;
|
|
35175
|
+
}
|
|
35176
|
+
if (tenantId) {
|
|
35177
|
+
contextClaims.tenant_id = tenantId;
|
|
35178
|
+
}
|
|
35179
|
+
if (contextClaims.user_id === void 0 && contextClaims.tenant_id === void 0) {
|
|
35180
|
+
return config;
|
|
35181
|
+
}
|
|
35182
|
+
return {
|
|
35183
|
+
...config,
|
|
35184
|
+
platformAuth: {
|
|
35185
|
+
...config.platformAuth,
|
|
35186
|
+
customClaims: {
|
|
35187
|
+
...contextClaims,
|
|
35188
|
+
...config.platformAuth?.customClaims || {}
|
|
35189
|
+
}
|
|
35190
|
+
}
|
|
35191
|
+
};
|
|
35192
|
+
}, "onFulfilled")
|
|
35193
|
+
}
|
|
35194
|
+
];
|
|
35195
|
+
}
|
|
35160
35196
|
/**
|
|
35161
35197
|
* 注册全局拦截器(用于单例实例)
|
|
35162
35198
|
*/
|
|
@@ -35182,27 +35218,6 @@ var PlatformHttpClientService = class _PlatformHttpClientService {
|
|
|
35182
35218
|
"x-tt-env": ttEnv
|
|
35183
35219
|
};
|
|
35184
35220
|
}
|
|
35185
|
-
const userId = this.requestContext.get("userId");
|
|
35186
|
-
const tenantIdRaw = this.requestContext.get("tenantId");
|
|
35187
|
-
const contextClaims = {};
|
|
35188
|
-
if (userId) {
|
|
35189
|
-
contextClaims.user_id = userId;
|
|
35190
|
-
}
|
|
35191
|
-
if (tenantIdRaw !== void 0 && tenantIdRaw !== "") {
|
|
35192
|
-
const tenantIdNum = typeof tenantIdRaw === "number" ? tenantIdRaw : Number(tenantIdRaw);
|
|
35193
|
-
if (Number.isFinite(tenantIdNum)) {
|
|
35194
|
-
contextClaims.tenant_id = tenantIdNum;
|
|
35195
|
-
}
|
|
35196
|
-
}
|
|
35197
|
-
if (contextClaims.user_id !== void 0 || contextClaims.tenant_id !== void 0) {
|
|
35198
|
-
config.platformAuth = {
|
|
35199
|
-
...config.platformAuth,
|
|
35200
|
-
customClaims: {
|
|
35201
|
-
...contextClaims,
|
|
35202
|
-
...config.platformAuth?.customClaims || {}
|
|
35203
|
-
}
|
|
35204
|
-
};
|
|
35205
|
-
}
|
|
35206
35221
|
return config;
|
|
35207
35222
|
}, (error) => {
|
|
35208
35223
|
this.logger.error("Server SDK HTTP Request Error", error, "HttpService");
|
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.11",
|
|
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": "
|
|
43
|
+
"@lark-apaas/http-client": "0.1.6-alpha.1",
|
|
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",
|