@lark-apaas/fullstack-nestjs-core 1.1.48-alpha.1 → 1.1.48-alpha.2
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 +12 -42
- package/dist/index.d.cts +7 -3
- package/dist/index.d.ts +7 -3
- package/dist/index.js +13 -43
- package/package.json +3 -2
package/dist/index.cjs
CHANGED
|
@@ -34437,6 +34437,7 @@ var import_axios2 = require("@nestjs/axios");
|
|
|
34437
34437
|
var import_nestjs_logger2 = require("@lark-apaas/nestjs-logger");
|
|
34438
34438
|
var import_nestjs_datapaas = require("@lark-apaas/nestjs-datapaas");
|
|
34439
34439
|
var import_nestjs_authnpaas = require("@lark-apaas/nestjs-authnpaas");
|
|
34440
|
+
var import_nestjs_http_forwarder = require("@lark-apaas/nestjs-http-forwarder");
|
|
34440
34441
|
var import_nestjs_trigger = require("@lark-apaas/nestjs-trigger");
|
|
34441
34442
|
var import_nestjs_common7 = require("@lark-apaas/nestjs-common");
|
|
34442
34443
|
var import_nestjs_capability = require("@lark-apaas/nestjs-capability");
|
|
@@ -35073,9 +35074,6 @@ var PlatformHttpClientService = class _PlatformHttpClientService {
|
|
|
35073
35074
|
client;
|
|
35074
35075
|
protectedClient;
|
|
35075
35076
|
logger = new import_common8.Logger(_PlatformHttpClientService.name);
|
|
35076
|
-
defaultPlatformConfig = {
|
|
35077
|
-
enabled: true
|
|
35078
|
-
};
|
|
35079
35077
|
constructor(requestContext) {
|
|
35080
35078
|
this.requestContext = requestContext;
|
|
35081
35079
|
const baseConfig = {
|
|
@@ -35083,11 +35081,12 @@ var PlatformHttpClientService = class _PlatformHttpClientService {
|
|
|
35083
35081
|
};
|
|
35084
35082
|
this.client = new import_http_client.HttpClient({
|
|
35085
35083
|
...baseConfig,
|
|
35086
|
-
|
|
35084
|
+
platform: {
|
|
35085
|
+
enabled: true
|
|
35086
|
+
}
|
|
35087
35087
|
});
|
|
35088
35088
|
this.protectedClient = new ProtectedHttpClient(this.client);
|
|
35089
35089
|
this.registerGlobalInterceptors();
|
|
35090
|
-
this.registerPlatformPluginForClient(this.client, this.defaultPlatformConfig);
|
|
35091
35090
|
}
|
|
35092
35091
|
/**
|
|
35093
35092
|
* 获取受保护的 HttpClient 实例(推荐)
|
|
@@ -35153,10 +35152,13 @@ var PlatformHttpClientService = class _PlatformHttpClientService {
|
|
|
35153
35152
|
...options?.config
|
|
35154
35153
|
};
|
|
35155
35154
|
const mergedPlatform = {
|
|
35156
|
-
|
|
35155
|
+
enabled: true,
|
|
35157
35156
|
...options?.platform
|
|
35158
35157
|
};
|
|
35159
|
-
return
|
|
35158
|
+
return new import_http_client.HttpClient({
|
|
35159
|
+
...mergedConfig,
|
|
35160
|
+
platform: mergedPlatform
|
|
35161
|
+
});
|
|
35160
35162
|
}
|
|
35161
35163
|
/**
|
|
35162
35164
|
* 创建一个带全局拦截器的独立 HttpClient 实例
|
|
@@ -35189,17 +35191,6 @@ var PlatformHttpClientService = class _PlatformHttpClientService {
|
|
|
35189
35191
|
registerGlobalInterceptors() {
|
|
35190
35192
|
this.registerInterceptorsForClient(this.client);
|
|
35191
35193
|
}
|
|
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
35194
|
/**
|
|
35204
35195
|
* 为指定的 HttpClient 实例注册标准拦截器
|
|
35205
35196
|
*
|
|
@@ -35219,30 +35210,6 @@ var PlatformHttpClientService = class _PlatformHttpClientService {
|
|
|
35219
35210
|
"x-tt-env": ttEnv
|
|
35220
35211
|
};
|
|
35221
35212
|
}
|
|
35222
|
-
const userIdRaw = this.requestContext.get("userId");
|
|
35223
|
-
const tenantIdRaw = this.requestContext.get("tenantId");
|
|
35224
|
-
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
|
-
}
|
|
35230
|
-
}
|
|
35231
|
-
if (tenantIdRaw !== void 0 && tenantIdRaw !== "") {
|
|
35232
|
-
const tenantIdNum = typeof tenantIdRaw === "number" ? tenantIdRaw : Number(tenantIdRaw);
|
|
35233
|
-
if (Number.isFinite(tenantIdNum)) {
|
|
35234
|
-
contextClaims.tenant_id = tenantIdNum;
|
|
35235
|
-
}
|
|
35236
|
-
}
|
|
35237
|
-
if (contextClaims.user_id !== void 0 || contextClaims.tenant_id !== void 0) {
|
|
35238
|
-
config.platformAuth = {
|
|
35239
|
-
...config.platformAuth,
|
|
35240
|
-
customClaims: {
|
|
35241
|
-
...contextClaims,
|
|
35242
|
-
...config.platformAuth?.customClaims || {}
|
|
35243
|
-
}
|
|
35244
|
-
};
|
|
35245
|
-
}
|
|
35246
35213
|
return config;
|
|
35247
35214
|
}, (error) => {
|
|
35248
35215
|
this.logger.error("Server SDK HTTP Request Error", error, "HttpService");
|
|
@@ -36405,6 +36372,9 @@ var PlatformModule = class _PlatformModule {
|
|
|
36405
36372
|
...options.authz || {}
|
|
36406
36373
|
}),
|
|
36407
36374
|
import_nestjs_trigger.AutomationModule.forRoot(),
|
|
36375
|
+
// 通用内网转发:自动注册 ALL /anycross/forward?targetUrl=...
|
|
36376
|
+
// 业务方接入 PlatformModule 后零改动获得内网代理路由
|
|
36377
|
+
import_nestjs_http_forwarder.HttpForwarderModule.forRoot(options.httpForwarder),
|
|
36408
36378
|
import_nestjs_capability.CapabilityModule.forRoot({
|
|
36409
36379
|
capabilitiesDir: options.capabilitiesDir,
|
|
36410
36380
|
enableWatching: process.env.NODE_ENV === "development"
|
package/dist/index.d.cts
CHANGED
|
@@ -2,6 +2,7 @@ import { NestModule, DynamicModule, MiddlewareConsumer, OnModuleInit, NestMiddle
|
|
|
2
2
|
import { HttpClientConfig, PlatformPluginOptions, HttpClient } from '@lark-apaas/http-client';
|
|
3
3
|
import { AuthZPaasModuleOptions } from '@lark-apaas/nestjs-authzpaas';
|
|
4
4
|
export { AddMembersParams, AuthZPaasModule, AuthorizationSDK, Can, CanRole, ChatSimpleDTO, CommonParam, CreateRoleParams, CreateRoleResponse, DepartmentDTO, DepartmentEntity, DepartmentSimpleDTO, FilterParams, ForceRoleDTO, I18nText, IPermissionResolver, ListMembersParams, ListMembersResponse, ListRolesParams, MemberMutationData, MemberType, PERMISSION_RESOLVER_TOKEN, PermissionPoint, PermissionRequirement, PresetGroupDTO, RemoveMembersParams, RoleMemberDTO, SearchChatEntity, SearchParams, SearchResponse, SearchResult, SearchUserEntity, UpdateRoleParams, UserSimpleDTO } from '@lark-apaas/nestjs-authzpaas';
|
|
5
|
+
import { HttpForwarderModuleOptions } from '@lark-apaas/nestjs-http-forwarder';
|
|
5
6
|
import { NestExpressApplication } from '@nestjs/platform-express';
|
|
6
7
|
import { PlatformHttpClient, RequestContextService, ObservableService } from '@lark-apaas/nestjs-common';
|
|
7
8
|
export { AutoTrace } from '@lark-apaas/nestjs-common';
|
|
@@ -78,6 +79,12 @@ interface PlatformModuleOptions {
|
|
|
78
79
|
* 可传入 permissionResolver 等选项,透传给 AuthZPaasModule.forRoot()
|
|
79
80
|
*/
|
|
80
81
|
authz?: AuthZPaasModuleOptions;
|
|
82
|
+
/**
|
|
83
|
+
* HttpForwarder 模块配置(默认自动启用,注册 ALL /anycross/forward 路由)
|
|
84
|
+
* 透传给 HttpForwarderModule.forRoot();不传则使用模块默认值
|
|
85
|
+
* (requestTimeoutMs=30s, maxResponseBytes=10MB)。
|
|
86
|
+
*/
|
|
87
|
+
httpForwarder?: HttpForwarderModuleOptions;
|
|
81
88
|
}
|
|
82
89
|
|
|
83
90
|
declare class PlatformModule implements NestModule {
|
|
@@ -308,7 +315,6 @@ declare class PlatformHttpClientService {
|
|
|
308
315
|
private readonly client;
|
|
309
316
|
private readonly protectedClient;
|
|
310
317
|
private readonly logger;
|
|
311
|
-
private readonly defaultPlatformConfig;
|
|
312
318
|
constructor(requestContext: RequestContextService);
|
|
313
319
|
/**
|
|
314
320
|
* 获取受保护的 HttpClient 实例(推荐)
|
|
@@ -390,8 +396,6 @@ declare class PlatformHttpClientService {
|
|
|
390
396
|
* 注册全局拦截器(用于单例实例)
|
|
391
397
|
*/
|
|
392
398
|
private registerGlobalInterceptors;
|
|
393
|
-
private createClientWithPlatform;
|
|
394
|
-
private registerPlatformPluginForClient;
|
|
395
399
|
/**
|
|
396
400
|
* 为指定的 HttpClient 实例注册标准拦截器
|
|
397
401
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { NestModule, DynamicModule, MiddlewareConsumer, OnModuleInit, NestMiddle
|
|
|
2
2
|
import { HttpClientConfig, PlatformPluginOptions, HttpClient } from '@lark-apaas/http-client';
|
|
3
3
|
import { AuthZPaasModuleOptions } from '@lark-apaas/nestjs-authzpaas';
|
|
4
4
|
export { AddMembersParams, AuthZPaasModule, AuthorizationSDK, Can, CanRole, ChatSimpleDTO, CommonParam, CreateRoleParams, CreateRoleResponse, DepartmentDTO, DepartmentEntity, DepartmentSimpleDTO, FilterParams, ForceRoleDTO, I18nText, IPermissionResolver, ListMembersParams, ListMembersResponse, ListRolesParams, MemberMutationData, MemberType, PERMISSION_RESOLVER_TOKEN, PermissionPoint, PermissionRequirement, PresetGroupDTO, RemoveMembersParams, RoleMemberDTO, SearchChatEntity, SearchParams, SearchResponse, SearchResult, SearchUserEntity, UpdateRoleParams, UserSimpleDTO } from '@lark-apaas/nestjs-authzpaas';
|
|
5
|
+
import { HttpForwarderModuleOptions } from '@lark-apaas/nestjs-http-forwarder';
|
|
5
6
|
import { NestExpressApplication } from '@nestjs/platform-express';
|
|
6
7
|
import { PlatformHttpClient, RequestContextService, ObservableService } from '@lark-apaas/nestjs-common';
|
|
7
8
|
export { AutoTrace } from '@lark-apaas/nestjs-common';
|
|
@@ -78,6 +79,12 @@ interface PlatformModuleOptions {
|
|
|
78
79
|
* 可传入 permissionResolver 等选项,透传给 AuthZPaasModule.forRoot()
|
|
79
80
|
*/
|
|
80
81
|
authz?: AuthZPaasModuleOptions;
|
|
82
|
+
/**
|
|
83
|
+
* HttpForwarder 模块配置(默认自动启用,注册 ALL /anycross/forward 路由)
|
|
84
|
+
* 透传给 HttpForwarderModule.forRoot();不传则使用模块默认值
|
|
85
|
+
* (requestTimeoutMs=30s, maxResponseBytes=10MB)。
|
|
86
|
+
*/
|
|
87
|
+
httpForwarder?: HttpForwarderModuleOptions;
|
|
81
88
|
}
|
|
82
89
|
|
|
83
90
|
declare class PlatformModule implements NestModule {
|
|
@@ -308,7 +315,6 @@ declare class PlatformHttpClientService {
|
|
|
308
315
|
private readonly client;
|
|
309
316
|
private readonly protectedClient;
|
|
310
317
|
private readonly logger;
|
|
311
|
-
private readonly defaultPlatformConfig;
|
|
312
318
|
constructor(requestContext: RequestContextService);
|
|
313
319
|
/**
|
|
314
320
|
* 获取受保护的 HttpClient 实例(推荐)
|
|
@@ -390,8 +396,6 @@ declare class PlatformHttpClientService {
|
|
|
390
396
|
* 注册全局拦截器(用于单例实例)
|
|
391
397
|
*/
|
|
392
398
|
private registerGlobalInterceptors;
|
|
393
|
-
private createClientWithPlatform;
|
|
394
|
-
private registerPlatformPluginForClient;
|
|
395
399
|
/**
|
|
396
400
|
* 为指定的 HttpClient 实例注册标准拦截器
|
|
397
401
|
*
|
package/dist/index.js
CHANGED
|
@@ -34410,6 +34410,7 @@ import { HttpModule } from "@nestjs/axios";
|
|
|
34410
34410
|
import { LoggerModule, AppLogger as AppLogger2, LoggerContextMiddleware } from "@lark-apaas/nestjs-logger";
|
|
34411
34411
|
import { DataPaasModule, SqlExecutionContextMiddleware } from "@lark-apaas/nestjs-datapaas";
|
|
34412
34412
|
import { AuthNPaasModule } from "@lark-apaas/nestjs-authnpaas";
|
|
34413
|
+
import { HttpForwarderModule } from "@lark-apaas/nestjs-http-forwarder";
|
|
34413
34414
|
import { AutomationModule } from "@lark-apaas/nestjs-trigger";
|
|
34414
34415
|
import { PLATFORM_HTTP_CLIENT as PLATFORM_HTTP_CLIENT4 } from "@lark-apaas/nestjs-common";
|
|
34415
34416
|
import { CapabilityModule } from "@lark-apaas/nestjs-capability";
|
|
@@ -34998,7 +34999,7 @@ FrameworkDebugMiddleware = _ts_decorate7([
|
|
|
34998
34999
|
|
|
34999
35000
|
// src/services/platform-http-client.service.ts
|
|
35000
35001
|
import { Injectable as Injectable8, Logger as Logger2 } from "@nestjs/common";
|
|
35001
|
-
import { HttpClient
|
|
35002
|
+
import { HttpClient } from "@lark-apaas/http-client";
|
|
35002
35003
|
import { RequestContextService as RequestContextService2 } from "@lark-apaas/nestjs-common";
|
|
35003
35004
|
function _ts_decorate8(decorators, target, key, desc) {
|
|
35004
35005
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -35046,9 +35047,6 @@ var PlatformHttpClientService = class _PlatformHttpClientService {
|
|
|
35046
35047
|
client;
|
|
35047
35048
|
protectedClient;
|
|
35048
35049
|
logger = new Logger2(_PlatformHttpClientService.name);
|
|
35049
|
-
defaultPlatformConfig = {
|
|
35050
|
-
enabled: true
|
|
35051
|
-
};
|
|
35052
35050
|
constructor(requestContext) {
|
|
35053
35051
|
this.requestContext = requestContext;
|
|
35054
35052
|
const baseConfig = {
|
|
@@ -35056,11 +35054,12 @@ var PlatformHttpClientService = class _PlatformHttpClientService {
|
|
|
35056
35054
|
};
|
|
35057
35055
|
this.client = new HttpClient({
|
|
35058
35056
|
...baseConfig,
|
|
35059
|
-
|
|
35057
|
+
platform: {
|
|
35058
|
+
enabled: true
|
|
35059
|
+
}
|
|
35060
35060
|
});
|
|
35061
35061
|
this.protectedClient = new ProtectedHttpClient(this.client);
|
|
35062
35062
|
this.registerGlobalInterceptors();
|
|
35063
|
-
this.registerPlatformPluginForClient(this.client, this.defaultPlatformConfig);
|
|
35064
35063
|
}
|
|
35065
35064
|
/**
|
|
35066
35065
|
* 获取受保护的 HttpClient 实例(推荐)
|
|
@@ -35126,10 +35125,13 @@ var PlatformHttpClientService = class _PlatformHttpClientService {
|
|
|
35126
35125
|
...options?.config
|
|
35127
35126
|
};
|
|
35128
35127
|
const mergedPlatform = {
|
|
35129
|
-
|
|
35128
|
+
enabled: true,
|
|
35130
35129
|
...options?.platform
|
|
35131
35130
|
};
|
|
35132
|
-
return
|
|
35131
|
+
return new HttpClient({
|
|
35132
|
+
...mergedConfig,
|
|
35133
|
+
platform: mergedPlatform
|
|
35134
|
+
});
|
|
35133
35135
|
}
|
|
35134
35136
|
/**
|
|
35135
35137
|
* 创建一个带全局拦截器的独立 HttpClient 实例
|
|
@@ -35162,17 +35164,6 @@ var PlatformHttpClientService = class _PlatformHttpClientService {
|
|
|
35162
35164
|
registerGlobalInterceptors() {
|
|
35163
35165
|
this.registerInterceptorsForClient(this.client);
|
|
35164
35166
|
}
|
|
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
35167
|
/**
|
|
35177
35168
|
* 为指定的 HttpClient 实例注册标准拦截器
|
|
35178
35169
|
*
|
|
@@ -35192,30 +35183,6 @@ var PlatformHttpClientService = class _PlatformHttpClientService {
|
|
|
35192
35183
|
"x-tt-env": ttEnv
|
|
35193
35184
|
};
|
|
35194
35185
|
}
|
|
35195
|
-
const userIdRaw = this.requestContext.get("userId");
|
|
35196
|
-
const tenantIdRaw = this.requestContext.get("tenantId");
|
|
35197
|
-
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
|
-
}
|
|
35203
|
-
}
|
|
35204
|
-
if (tenantIdRaw !== void 0 && tenantIdRaw !== "") {
|
|
35205
|
-
const tenantIdNum = typeof tenantIdRaw === "number" ? tenantIdRaw : Number(tenantIdRaw);
|
|
35206
|
-
if (Number.isFinite(tenantIdNum)) {
|
|
35207
|
-
contextClaims.tenant_id = tenantIdNum;
|
|
35208
|
-
}
|
|
35209
|
-
}
|
|
35210
|
-
if (contextClaims.user_id !== void 0 || contextClaims.tenant_id !== void 0) {
|
|
35211
|
-
config.platformAuth = {
|
|
35212
|
-
...config.platformAuth,
|
|
35213
|
-
customClaims: {
|
|
35214
|
-
...contextClaims,
|
|
35215
|
-
...config.platformAuth?.customClaims || {}
|
|
35216
|
-
}
|
|
35217
|
-
};
|
|
35218
|
-
}
|
|
35219
35186
|
return config;
|
|
35220
35187
|
}, (error) => {
|
|
35221
35188
|
this.logger.error("Server SDK HTTP Request Error", error, "HttpService");
|
|
@@ -36378,6 +36345,9 @@ var PlatformModule = class _PlatformModule {
|
|
|
36378
36345
|
...options.authz || {}
|
|
36379
36346
|
}),
|
|
36380
36347
|
AutomationModule.forRoot(),
|
|
36348
|
+
// 通用内网转发:自动注册 ALL /anycross/forward?targetUrl=...
|
|
36349
|
+
// 业务方接入 PlatformModule 后零改动获得内网代理路由
|
|
36350
|
+
HttpForwarderModule.forRoot(options.httpForwarder),
|
|
36381
36351
|
CapabilityModule.forRoot({
|
|
36382
36352
|
capabilitiesDir: options.capabilitiesDir,
|
|
36383
36353
|
enableWatching: process.env.NODE_ENV === "development"
|
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.2",
|
|
4
4
|
"description": "FullStack Nestjs Core",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -40,12 +40,13 @@
|
|
|
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",
|
|
47
47
|
"@lark-apaas/nestjs-common": "^0.1.8",
|
|
48
48
|
"@lark-apaas/nestjs-datapaas": "^1.0.19",
|
|
49
|
+
"@lark-apaas/nestjs-http-forwarder": "0.1.1-alpha.1",
|
|
49
50
|
"@lark-apaas/nestjs-logger": "^1.0.16",
|
|
50
51
|
"@lark-apaas/nestjs-observable": "^0.0.11",
|
|
51
52
|
"@lark-apaas/nestjs-openapi-devtools": "^1.0.10",
|