@lark-apaas/fullstack-nestjs-core 1.1.48-alpha.1 → 1.1.48-alpha.10

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
@@ -35073,9 +35073,6 @@ var PlatformHttpClientService = class _PlatformHttpClientService {
35073
35073
  client;
35074
35074
  protectedClient;
35075
35075
  logger = new import_common8.Logger(_PlatformHttpClientService.name);
35076
- defaultPlatformConfig = {
35077
- enabled: true
35078
- };
35079
35076
  constructor(requestContext) {
35080
35077
  this.requestContext = requestContext;
35081
35078
  const baseConfig = {
@@ -35083,11 +35080,12 @@ var PlatformHttpClientService = class _PlatformHttpClientService {
35083
35080
  };
35084
35081
  this.client = new import_http_client.HttpClient({
35085
35082
  ...baseConfig,
35086
- baseURL: (0, import_http_client.resolvePlatformBaseURL)(this.defaultPlatformConfig)
35083
+ platform: {
35084
+ enabled: true
35085
+ }
35087
35086
  });
35088
35087
  this.protectedClient = new ProtectedHttpClient(this.client);
35089
35088
  this.registerGlobalInterceptors();
35090
- this.registerPlatformPluginForClient(this.client, this.defaultPlatformConfig);
35091
35089
  }
35092
35090
  /**
35093
35091
  * 获取受保护的 HttpClient 实例(推荐)
@@ -35153,10 +35151,13 @@ var PlatformHttpClientService = class _PlatformHttpClientService {
35153
35151
  ...options?.config
35154
35152
  };
35155
35153
  const mergedPlatform = {
35156
- ...this.defaultPlatformConfig,
35154
+ enabled: true,
35157
35155
  ...options?.platform
35158
35156
  };
35159
- return this.createClientWithPlatform(mergedConfig, mergedPlatform);
35157
+ return new import_http_client.HttpClient({
35158
+ ...mergedConfig,
35159
+ platform: mergedPlatform
35160
+ });
35160
35161
  }
35161
35162
  /**
35162
35163
  * 创建一个带全局拦截器的独立 HttpClient 实例
@@ -35189,17 +35190,6 @@ var PlatformHttpClientService = class _PlatformHttpClientService {
35189
35190
  registerGlobalInterceptors() {
35190
35191
  this.registerInterceptorsForClient(this.client);
35191
35192
  }
35192
- createClientWithPlatform(config, platform) {
35193
- const client = new import_http_client.HttpClient({
35194
- ...config,
35195
- baseURL: (0, import_http_client.resolvePlatformBaseURL)(platform)
35196
- });
35197
- this.registerPlatformPluginForClient(client, platform);
35198
- return client;
35199
- }
35200
- registerPlatformPluginForClient(client, platform) {
35201
- (0, import_http_client.registerPlatformPlugin)(client.interceptors, platform);
35202
- }
35203
35193
  /**
35204
35194
  * 为指定的 HttpClient 实例注册标准拦截器
35205
35195
  *
@@ -35219,14 +35209,11 @@ var PlatformHttpClientService = class _PlatformHttpClientService {
35219
35209
  "x-tt-env": ttEnv
35220
35210
  };
35221
35211
  }
35222
- const userIdRaw = this.requestContext.get("userId");
35212
+ const userId = this.requestContext.get("userId");
35223
35213
  const tenantIdRaw = this.requestContext.get("tenantId");
35224
35214
  const contextClaims = {};
35225
- if (userIdRaw !== void 0 && userIdRaw !== "") {
35226
- const userIdNum = typeof userIdRaw === "number" ? userIdRaw : Number(userIdRaw);
35227
- if (Number.isFinite(userIdNum)) {
35228
- contextClaims.user_id = userIdNum;
35229
- }
35215
+ if (userId) {
35216
+ contextClaims.user_id = userId;
35230
35217
  }
35231
35218
  if (tenantIdRaw !== void 0 && tenantIdRaw !== "") {
35232
35219
  const tenantIdNum = typeof tenantIdRaw === "number" ? tenantIdRaw : Number(tenantIdRaw);
package/dist/index.d.cts CHANGED
@@ -308,7 +308,6 @@ declare class PlatformHttpClientService {
308
308
  private readonly client;
309
309
  private readonly protectedClient;
310
310
  private readonly logger;
311
- private readonly defaultPlatformConfig;
312
311
  constructor(requestContext: RequestContextService);
313
312
  /**
314
313
  * 获取受保护的 HttpClient 实例(推荐)
@@ -390,8 +389,6 @@ declare class PlatformHttpClientService {
390
389
  * 注册全局拦截器(用于单例实例)
391
390
  */
392
391
  private registerGlobalInterceptors;
393
- private createClientWithPlatform;
394
- private registerPlatformPluginForClient;
395
392
  /**
396
393
  * 为指定的 HttpClient 实例注册标准拦截器
397
394
  *
package/dist/index.d.ts CHANGED
@@ -308,7 +308,6 @@ declare class PlatformHttpClientService {
308
308
  private readonly client;
309
309
  private readonly protectedClient;
310
310
  private readonly logger;
311
- private readonly defaultPlatformConfig;
312
311
  constructor(requestContext: RequestContextService);
313
312
  /**
314
313
  * 获取受保护的 HttpClient 实例(推荐)
@@ -390,8 +389,6 @@ declare class PlatformHttpClientService {
390
389
  * 注册全局拦截器(用于单例实例)
391
390
  */
392
391
  private registerGlobalInterceptors;
393
- private createClientWithPlatform;
394
- private registerPlatformPluginForClient;
395
392
  /**
396
393
  * 为指定的 HttpClient 实例注册标准拦截器
397
394
  *
package/dist/index.js CHANGED
@@ -34998,7 +34998,7 @@ FrameworkDebugMiddleware = _ts_decorate7([
34998
34998
 
34999
34999
  // src/services/platform-http-client.service.ts
35000
35000
  import { Injectable as Injectable8, Logger as Logger2 } from "@nestjs/common";
35001
- import { HttpClient, registerPlatformPlugin, resolvePlatformBaseURL } from "@lark-apaas/http-client";
35001
+ import { HttpClient } from "@lark-apaas/http-client";
35002
35002
  import { RequestContextService as RequestContextService2 } from "@lark-apaas/nestjs-common";
35003
35003
  function _ts_decorate8(decorators, target, key, desc) {
35004
35004
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -35046,9 +35046,6 @@ var PlatformHttpClientService = class _PlatformHttpClientService {
35046
35046
  client;
35047
35047
  protectedClient;
35048
35048
  logger = new Logger2(_PlatformHttpClientService.name);
35049
- defaultPlatformConfig = {
35050
- enabled: true
35051
- };
35052
35049
  constructor(requestContext) {
35053
35050
  this.requestContext = requestContext;
35054
35051
  const baseConfig = {
@@ -35056,11 +35053,12 @@ var PlatformHttpClientService = class _PlatformHttpClientService {
35056
35053
  };
35057
35054
  this.client = new HttpClient({
35058
35055
  ...baseConfig,
35059
- baseURL: resolvePlatformBaseURL(this.defaultPlatformConfig)
35056
+ platform: {
35057
+ enabled: true
35058
+ }
35060
35059
  });
35061
35060
  this.protectedClient = new ProtectedHttpClient(this.client);
35062
35061
  this.registerGlobalInterceptors();
35063
- this.registerPlatformPluginForClient(this.client, this.defaultPlatformConfig);
35064
35062
  }
35065
35063
  /**
35066
35064
  * 获取受保护的 HttpClient 实例(推荐)
@@ -35126,10 +35124,13 @@ var PlatformHttpClientService = class _PlatformHttpClientService {
35126
35124
  ...options?.config
35127
35125
  };
35128
35126
  const mergedPlatform = {
35129
- ...this.defaultPlatformConfig,
35127
+ enabled: true,
35130
35128
  ...options?.platform
35131
35129
  };
35132
- return this.createClientWithPlatform(mergedConfig, mergedPlatform);
35130
+ return new HttpClient({
35131
+ ...mergedConfig,
35132
+ platform: mergedPlatform
35133
+ });
35133
35134
  }
35134
35135
  /**
35135
35136
  * 创建一个带全局拦截器的独立 HttpClient 实例
@@ -35162,17 +35163,6 @@ var PlatformHttpClientService = class _PlatformHttpClientService {
35162
35163
  registerGlobalInterceptors() {
35163
35164
  this.registerInterceptorsForClient(this.client);
35164
35165
  }
35165
- createClientWithPlatform(config, platform) {
35166
- const client = new HttpClient({
35167
- ...config,
35168
- baseURL: resolvePlatformBaseURL(platform)
35169
- });
35170
- this.registerPlatformPluginForClient(client, platform);
35171
- return client;
35172
- }
35173
- registerPlatformPluginForClient(client, platform) {
35174
- registerPlatformPlugin(client.interceptors, platform);
35175
- }
35176
35166
  /**
35177
35167
  * 为指定的 HttpClient 实例注册标准拦截器
35178
35168
  *
@@ -35192,14 +35182,11 @@ var PlatformHttpClientService = class _PlatformHttpClientService {
35192
35182
  "x-tt-env": ttEnv
35193
35183
  };
35194
35184
  }
35195
- const userIdRaw = this.requestContext.get("userId");
35185
+ const userId = this.requestContext.get("userId");
35196
35186
  const tenantIdRaw = this.requestContext.get("tenantId");
35197
35187
  const contextClaims = {};
35198
- if (userIdRaw !== void 0 && userIdRaw !== "") {
35199
- const userIdNum = typeof userIdRaw === "number" ? userIdRaw : Number(userIdRaw);
35200
- if (Number.isFinite(userIdNum)) {
35201
- contextClaims.user_id = userIdNum;
35202
- }
35188
+ if (userId) {
35189
+ contextClaims.user_id = userId;
35203
35190
  }
35204
35191
  if (tenantIdRaw !== void 0 && tenantIdRaw !== "") {
35205
35192
  const tenantIdNum = typeof tenantIdRaw === "number" ? tenantIdRaw : Number(tenantIdRaw);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/fullstack-nestjs-core",
3
- "version": "1.1.48-alpha.1",
3
+ "version": "1.1.48-alpha.10",
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.6-alpha.0",
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",