@lark-apaas/fullstack-nestjs-core 1.1.47-alpha.0 → 1.1.47-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
@@ -35209,6 +35209,27 @@ var PlatformHttpClientService = class _PlatformHttpClientService {
35209
35209
  "x-tt-env": ttEnv
35210
35210
  };
35211
35211
  }
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
+ }
35212
35233
  return config;
35213
35234
  }, (error) => {
35214
35235
  this.logger.error("Server SDK HTTP Request Error", error, "HttpService");
package/dist/index.js CHANGED
@@ -35182,6 +35182,27 @@ var PlatformHttpClientService = class _PlatformHttpClientService {
35182
35182
  "x-tt-env": ttEnv
35183
35183
  };
35184
35184
  }
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
+ }
35185
35206
  return config;
35186
35207
  }, (error) => {
35187
35208
  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.47-alpha.0",
3
+ "version": "1.1.47-alpha.1",
4
4
  "description": "FullStack Nestjs Core",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",